Attached program is mktime() test usually runs by configure scripts. This test behaves badly (terminates with SIGALRM) if compiled with '-O2', but works as expected when compiled with '-O2 -fno-tree-vrp'. I'm able to reproduce it on two systems: 1) x86_64 Fedora 8, kernel is 2.6.24.3, gcc 4.3 configured as: Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-cpu=generic --build=x86_64-redhat-linux Thread model: posix gcc version 4.3.0 20080307 (Red Hat 4.3.0-2) (GCC) 2) i386 FreeBSD 7.0 (7.0-STABLE), gcc 4.3 configured with: Using built-in specs. Target: i386-unknown-freebsd7.0 Configured with: ../gcc-4.3.0/configure --program-suffix=43 --prefix=/usr/local --enable-checking=none --enable-multilib --enable-__cxa_atexit --enable-threads=posix --enable-languages=c,c++ --disable-nls --with-cpu=pentium4 --with-system-zlib Thread model: posix gcc version 4.3.0 (GCC)
Created attachment 15314 [details] mktime() test from configure
The test has undefined behavior in it as signed integer overflow is undefined. time_t is a signed integer.
(In reply to comment #2) > The test has undefined behavior in it as signed integer overflow is undefined. > time_t is a signed integer. Ok, I'll contact autoconf authors with this issue. BTW, what about issuing the warning like [file][line]: warning: operation on [whatever] may be undefined just like in the classic case i = ++i + ++i; ?
(In reply to comment #3) > Ok, I'll contact autoconf authors with this issue. That's pretty funny that you encounter this AC_FUNC_MKTIME bug now which when I encountered it asked about it on the GCC list and which caused this gigantic thread (and sometime later the overflow warnings were implemented, see <http://gcc.gnu.org/gcc-4.2/changes.html> for a high-level description). Anyway, here's the thread and also the patch that fixed this in Autoconf (unfortunately, you still have to wait for the next stable release :-( <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/8152/focus=8281>
OK, I've found -[Wf]strict-overflow. Sorry for the dumb question. But, why not enable -Wstrict-overflow=[2345] by default when -Wextra is specified?