* m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 22 Dec 2006 08:53:57 +0000 (08:53 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 22 Dec 2006 08:53:57 +0000 (08:53 +0000)
commit2806e06eadd29e08f57489ed23eff8c7be8ce2d8
treeb300531503187c4b32b86c36c72080d38fbfef4b
parent44fa0d78ad36205f393cd4aa4813d1e7a403d6dc
* m4/mktime.m4 (AC_FUNC_MKTIME): Sync from Autoconf.
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
m4/mktime.m4