Created attachment 5195 [details] patch 1 The following assertion in mktime.c: verify (long_int_year_and_yday_are_wide_enough, INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX); is not satisfiable on any ILP32 architecture with 64-bit time_t. I propose the following patch to fix the problem. Given the purpose of this assertion, I've split my patch in 3 to prove that it doesn't introduce any regression. Here's my semi-formal proof: First let A be (INT_MAX <= LONG_MAX / 2). - Patch #1: This works on the assumption that for any value of LONG_MAX, the whole function either works correctly or fails to compile. With my patch, if a certain condition A is met, every instance of `long' type is replaced with `time_t', and the assertion that checks for LONG_MAX now checks for TIME_T_MAX in its place. It must remain true that for any value of TIME_T_MAX, the whole function either works correctly or fails to compile, regardless of condition A. - Patch #2: If condition A is met, clearly the assertion will always suceed, so it can be removed. - Patch #3: If condition A is met, the second assertion is skipped, which is equivalent to making A one of its options. (or in plain English, if longs are too short, time_ts can be used instead)
Created attachment 5196 [details] patch 2
Created attachment 5197 [details] patch 3
I forgot something regarding patch #1. If the assert is going to pass with its left part, then condition A is met, and as a result long is used and its left part remains unmodified by my patch. If the assert is going to pass with its right part, or not pass at all, then my change is not relevant. So in either case, no regression is introduced.
There are no ILP32 machine supported. Why should anything be done?
This should have been fixed in glibc 2.16 as part of the x32 port.