[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#430957: compiling with -O3 takes too long/hangs on some files



Package: gcc-snapshot
Version: 20070613-1
Severity: minor

--- Please enter the report below this line. ---

Using gcc-4.2 to compile with -O3 server-th.c:

$ time gcc-4.2 -DHAVE_CONFIG_H -I. -I../../../clamd -I.. -I../../..
-I../../../shared -I../../../libclamav    -pedantic -Wextra -Wall
-Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization
-Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-nonliteral -Winline
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs
-Wno-unused-parameter -Wpointer-arith -Wshadow -Wstrict-prototypes
-Wswitch -Wundef -Wwrite-strings -O3 -DNDEBUG -Wstack-protector
-fstack-protector -D_FORTIFY_SOURCE=2 -march=k8 -mfpmath=sse -msse
-msse2 -m3dnow -mmmx -MT server-th.o -MD -MP -MF ".deps/server-th.Tpo"
-c -o server-th.o ../../../clamd/server-th.c

real    0m0.633s
user    0m0.333s
sys     0m0.033s

Using gcc-4.3 snapshot to compile with -O2:

$ time /usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -I.
-I../../../clamd -I.. -I../../.. -I../../../shared
-I../../../libclamav    -pedantic -Wextra -Wall -Wbad-function-cast
-Wcast-align -Wcast-qual -Wdisabled-optimization -Wendif-labels
-Wfloat-equal -Wformat=2 -Wformat-nonliteral -Winline
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs
-Wno-unused-parameter -Wpointer-arith -Wshadow -Wstrict-prototypes
-Wswitch -Wundef -Wwrite-strings -O2 -DNDEBUG -Wstack-protector
-fstack-protector -D_FORTIFY_SOURCE=2 -march=k8 -mfpmath=sse -msse
-msse2 -m3dnow -mmmx -MT server-th.o -MD -MP -MF ".deps/server-th.Tpo"
-c -o server-th.o ../../../clamd/server-th.c

real    0m0.822s
user    0m0.721s
sys     0m0.033s

Using gcc-4.3 snapshot to compile with -O3:
$ time /usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -I.
-I../../../clamd -I.. -I../../.. -I../../../shared
-I../../../libclamav    -pedantic -Wextra -Wall -Wbad-function-cast
-Wcast-align -Wcast-qual -Wdisabled-optimization -Wendif-labels
-Wfloat-equal -Wformat=2 -Wformat-nonliteral -Winline
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs
-Wno-unused-parameter -Wpointer-arith -Wshadow -Wstrict-prototypes
-Wswitch -Wundef -Wwrite-strings -O3 -DNDEBUG -Wstack-protector
-fstack-protector -D_FORTIFY_SOURCE=2 -march=k8 -mfpmath=sse -msse
-msse2 -m3dnow -mmmx -MT server-th.o -MD -MP -MF ".deps/server-th.Tpo"
-c -o server-th.o ../../../clamd/server-th.c

Didn't finish even after 1m37s, strace shows gcc doing a bunch of
mmap/munmap/brk (lots of mallocs?)

However if I use -O2 -finline-functions -funswitch-loops
-fgcse-after-reload -fpredictive-commoning (which according to the
manpage should be equivalent), I get <1s compile time.

Using 'gcc -c -Q -O2 -finline-functions -funswitch-loops
-fgcse-after-reload --help=optimizers', and 'gcc -c -Q -O3
--help=optimizers' as manpage suggests gives no difference.

What options does -O3 enable on gcc-4.3 that cause this slowdown in
compile-time?
I know that -O3 is expected to increase compile time, but this great
increase in compile time compared to gcc-4.2 may hide a bug?

The file I used to test can be found in the debian clamav package
clamd/server-th.c, or here:
http://svn.clamav.net/websvn/filedetails.php?repname=clamav-devel&path=%2Ftrunk%2Fclamd%2Fserver-th.c&rev=0&sc=0

--- System information. ---
Architecture: amd64
Kernel:       Linux 2.6.22-rc5-hrt1-cfs-v18-g75154f40-dirty

Debian Release: lenny/sid
 500 unstable        www.debian-multimedia.org
 500 unstable        ftp.iasi.roedu.net
 500 testing         ftp.iasi.roedu.net
 500 etch            debian.beryl-project.org
   1 experimental    ftp.iasi.roedu.net

--- Package information. ---
Depends                      (Version) | Installed
======================================-+-====================
binutils                     (>= 2.17) | 2.17cvs20070426-8
libc6-dev                   (>= 2.3.6) | 2.5-11
libasound2                 (>> 1.0.14) | 1.0.14a-1
libatk1.0-0                (>= 1.13.2) | 1.18.0-2
libc6                       (>= 2.5-5) | 2.5-11
libcairo2                   (>= 1.4.0) | 1.4.6-1.1
libfontconfig1              (>= 2.4.0) | 2.4.2-1.2
libfreetype6                  (>= 2.2) | 2.2.1-6
libgcc1            (>= 1:4.2-20070516) | 1:4.2-20070609-1
libgcj-bc                 (>= 4.1.2-1) | 4.1.2-3
libglib2.0-0               (>= 2.12.9) | 2.12.12-1
libgmp3c2                              | 2:4.2.1+dfsg-4
libgtk2.0-0                (>= 2.10.3) | 2.10.12-2
libice6                   (>= 1:1.0.0) | 1:1.0.3-2
libjack0                  (>= 0.103.0) | 0.103.0-5
libmpfr1                               | 2.2.1.dfsg.1-2
libpango1.0-0              (>= 1.16.4) | 1.16.4-1
libpng12-0               (>= 1.2.13-4) | 1.2.15~beta5-2
libsm6                                 | 2:1.0.3-1
libstdc++6           (>= 4.2-20070516) | 4.2-20070609-1
libx11-6                               | 2:1.0.3-7
libxcursor1                 (>> 1.1.2) | 1:1.1.8-2
libxext6                               | 1:1.0.3-2
libxfixes3                (>= 1:4.0.1) | 1:4.0.3-2
libxi6                                 | 1:1.0.1-4
libxinerama1                           | 1:1.0.2-1
libxrandr2                (>= 2:1.2.0) | 2:1.2.1-1
libxrender1                            | 1:0.9.2-1
libxtst6                               | 1:1.0.2-1
zlib1g                    (>= 1:1.2.1) | 1:1.2.3-15



Reply to: