Bug 34477 - [4.3 regression] Standard autoconf mktime test is too slow when compiled with -O2
Summary: [4.3 regression] Standard autoconf mktime test is too slow when compiled with...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-15 10:27 UTC by İsmail Dönmez
Modified: 2007-12-15 11:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
testcase (1.42 KB, text/plain)
2007-12-15 10:27 UTC, İsmail Dönmez
Details
Testcase with unsigned long values (1.42 KB, text/x-csrc)
2007-12-15 11:52 UTC, İsmail Dönmez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description İsmail Dönmez 2007-12-15 10:27:31 UTC
See the timing, testcase is the usual mktime test from autoconf :

[~]> gcc -O2 -o mktime mktime.c
[~]> time ./mktime
zsh: alarm      ./mktime
./mktime  32,22s user 27,70s system 99% cpu 1:00,00 total

[~]> gcc -o mktime mktime.c
[~]> time ./mktime
./mktime  0,04s user 0,03s system 100% cpu 0,067 total

[~]> gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc/4.3.0 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/include --datadir=/usr/share/gcc/i686-pc-linux-gnu/4.3.0 --mandir=/usr/share/gcc/i686-pc-linux-gnu/4.3.0/man --infodir=/usr/share/gcc/i686-pc-linux-gnu/4.3.0/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.3.0/include/g++-v3 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-libgcj --disable-libssp --disable-multilib --disable-nls --disable-werror --enable-checking=release --enable-clocale=gnu --enable-__cxa_atexit --enable-languages=c,c++,fortran,objc,obj-c++,treelang --enable-libstdcxx-allocator=new --enable-shared --enable-ssp --enable-threads=posix --enable-version-specific-runtime-libs --without-included-gettext --without-system-libunwind --with-system-zlib --with-pkgversion='Pardus Linux' --with-bugurl=http://bugs.pardus.org.tr
Thread model: posix
gcc version 4.3.0 20071215 [trunk revision 130952] (Pardus Linux)
Comment 1 İsmail Dönmez 2007-12-15 10:27:53 UTC
Created attachment 14766 [details]
testcase
Comment 2 İsmail Dönmez 2007-12-15 10:30:38 UTC
Timings with gcc 3.4.6 :

[~]> gcc -o mktime mktime.c
[~]> time ./mktime

real    0m0.052s
user    0m0.021s

[~]> gcc -O2 -o mktime mktime.c
[~]> time ./mktime

real    0m0.032s
user    0m0.021s
sys     0m0.011s

So this is a regression.
Comment 3 Andrew Pinski 2007-12-15 11:43:18 UTC
Hmm, I think time_t is signed so this is just a case of signed overflow being undefined.
Comment 4 Andrew Pinski 2007-12-15 11:46:15 UTC
Yes this is invalid, time_t is signed so the following loop is empty:

  for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
    continue;


Comment 5 İsmail Dönmez 2007-12-15 11:52:12 UTC
I don't believe this is invalid changing time_t_max and time_t_min to unsigned long doesn't fix the problem.
Comment 6 İsmail Dönmez 2007-12-15 11:52:55 UTC
Created attachment 14768 [details]
Testcase with unsigned long values