compiling example code http://ludojad.itpp.pl/~eleven/timest-geborken.cpp (calculates two dates with strptime into tm structure and displays timestamps using mktime() call) with gcc-3.4.1 results with false results (1086085981 1086089401). same program compiled with gcc-3.3.3 works fine (result: 1086085981 1086085801). Reproducible: Always Steps to Reproduce: 1. compile the example code with gcc-3.4.1 (g++ -Wall -o sample timest-geborken.cpp) 2. run sample 3. compare both timestamps. Actual Results: start: 2004060112:30:01 stomp: 2004060112:33:01 1086085981 1086089401 Expected Results: start: 2004060112:30:01 stomp: 2004060112:33:01 1086085981 1086085801 Gentoo Base System version 1.4.16 Portage 2.0.50-r9 (gcc34-amd64-2004.1, gcc-3.4.1, glibc-2.3.4.20040605-r0, 2.6. 7-gentoo-r11) ================================================================= System uname: 2.6.7-gentoo-r11 x86_64 12 Autoconf: sys-devel/autoconf-2.59-r3 Automake: sys-devel/automake-1.8.3 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CFLAGS="-O2 -pipe -march=athlon64 -frename-registers -fweb -ffast-math - mfpmath=sse -ftracer -funroll-loops" CHOST="x86_64-pc-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3. 2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/ share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ / usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/ share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -pipe -march=athlon64 -frename-registers -fweb -ffast-math - mfpmath=sse -ftracer -funroll-loops" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/ Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/usr/local/portage" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X aalib acl acpi alsa amd64 apache2 apm avi berkdb crypt cups dga divx4linux dv encode exif fam ffmpeg foomaticdb gd gdbm gif gphoto2 gpm gtk2 imlib jpeg kde ldap libg++ libwww mikmod motif mozilla mpeg multilib ncurses nls oggvorbis opengl pam pdflib perl png postgres python qt quicktime radeon readline sdl slang spell ssl tcpd tetex truetype xinerama xml2 xmms xv zlib"
start: 2004060112:30:01 stomp: 2004060112:33:01 1086111181 1086111001 i see the expected 180 seconds this is with 3.4.1-r2 can you try 3.4.1-r2 to see if you get the same wrong results, although if you did i couldnt offer an explanation since it works for me (i'm on x86, not amd64)
I haven't tried it yet, but - adding -Os to gcc generates proper result...
more information: 1. it's C++ independent - happens the same after I rewrote it to lame C (timest-geborken.c in the same place as the original). forcing 32bit code with -m32 generates proper code (with gcc 3.4.1): $ gcc -m32 -Wall -o ctest test.c $ ./ctest 2004060112:30:01 2004060112:33:01 1086085981 1086085801 $ gcc -Wall -o ctest test.c $ ./ctest 2004060112:30:01 2004060112:33:01 1086085981 1086089401
ayanami root # g++ timest-geborken.cpp -o test ayanami root # ./test start: 2004060112:30:01 stomp: 2004060112:33:01 1086107581 1086107401 ayanami root # gcc --version gcc (GCC) 3.4.1 (Gentoo Hardened Linux 3.4.1, ssp-3.4-2, pie-8.7.6.3) it seems to work here?
and just in case you're curious: ayanami root # /lib/libc.so.6 GNU C Library 20040808 release version 2.3.4, by Roland McGrath et al.
Link is dead, so I can get the testcase. Please try with gcc-3.4.4-r1 and reopen if its still an issue.