* lib/autoconf/functions.m4 (AC_FUNC_MKTIME):
commit7bd79987b05c64647c168df92c6151adbfb1b283
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 22 Dec 2006 08:42:17 +0000 (22 08:42 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 22 Dec 2006 08:42:17 +0000 (22 08:42 +0000)
tree35aba891f8a7a0112648b1ffdc6c8f041600f21b
parent3853f83efbbca82722c41de1c7720af33810dce3
* lib/autoconf/functions.m4 (AC_FUNC_MKTIME):
Include <limits.h>, and use its INT_MAX to rewrite the
j loop so that it does not overflow 'int'.  Problem reported by
Ralf Wildenhues in
<http://lists.gnu.org/archive/html/bug-gnulib/2006-12/msg00084.html>.
Play it safe by shifting left by 1 rather than multiplying by 2,
as GCC is less likely to optimize this away when the value
is signed (when it assumes overflow leads to undefined behavior).
Also, don't assume time_t uses two's complement.
ChangeLog
lib/autoconf/functions.m4