[Bug 900994] Re: incorrect output of mktime or sth else
Junjie Wu
900994 at bugs.launchpad.net
Wed Dec 7 20:51:54 UTC 2011
wrong code indeed. Sorry
** Changed in: gcc-4.5 (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.5 in Ubuntu.
https://bugs.launchpad.net/bugs/900994
Title:
incorrect output of mktime or sth else
Status in “gcc-4.5” package in Ubuntu:
Invalid
Bug description:
I have some weird output for the attached simple code. I tested on different machines and the following line is what I used to compile/run the code.
for i in {1..10}; do rm -f date && g++ -o date -Wall -Wextra date2.cc && ./date; done
I am in EST timezone (GMT-5), and expected output is:
2011 1 1 0 0 5
18000
All gcc/g++ are installed using the package system without any
customization.
==================
First set of machines, Ubuntu 11.04 64bit
Linux ******* 2.6.38-13-generic #52-Ubuntu SMP Tue Nov 8 16:53:51 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
Linux ******* 2.6.38-12-server #51-Ubuntu SMP Wed Sep 28 16:07:08 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
==================
Gcc works 100% fine, but g++-4.5.2 and 4.4.5 both gave wrong results SOMETIMES.
I reproduced this behavior on my own desktop, and two servers.
2011 1 1 0 0 5
14400
2011 1 1 0 0 5
18000
2011 1 1 0 0 5
18000
2011 1 1 0 0 5
14400
2011 1 1 0 0 5
14400
2011 1 1 0 0 5
18000
2011 1 1 0 0 5
18000
2011 1 1 0 0 5
14400
2011 1 1 0 0 5
18000
2011 1 1 0 0 5
18000
===================
Second set of machines, Ubuntu 11.10 64bit
Linux ubuntu-VB 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
Linux ******* 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
===================
gcc/g++4.6.1, 4.5.4, 4.4.6 all gave wrong results, consistently. I reproduced same behavior on my VIrtualbox machine and a real server.
2011 1 1 0 0 5
14400
===================
Third machine (no bug)
RedHat EL5 (in university)
Linux ******* 2.6.18-274.7.1.el5 #1 SMP Mon Oct 17 11:57:14 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
===================
*******% g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)
Btw, I am aware of the fact that the behavior seems to be independent of the version of gcc/g++, but Ubuntu version. I only tested all gcc/g++ versions available in the package system. On 11.04, gcc always output correctly and g++ produce inconsistent results. On 11.10, gcc/g++ all produce wrong results consistently (off by -3600). This could be some bug outside gcc/g++, but should at least be a problem of Ubuntu configuration. The machines used here are all independently installed/configured by different people.
Another side note:
If I remove line 8 and 9, the behavior will be different. On 11.04, it's the same. On 11.10, gcc will consistently output 14400, while g++ output inconsistently (18000 or 14400).
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/900994/+subscriptions
More information about the foundations-bugs
mailing list