This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41287] New: -O1 optimisation of for loops in some cases omits essential functionality resulting in failed applications
- From: "mhenson at clarityvi dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Sep 2009 00:55:44 -0000
- Subject: [Bug c++/41287] New: -O1 optimisation of for loops in some cases omits essential functionality resulting in failed applications
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the attached standalone test case (depends only on ::memcpy in string.h),
the test fails when compiled with -O1 but succeeds with all other optimisations
(-O0, -O2, -O3).
Files attached:
testOpt.cpp - standalone test with compilation information included in the
file.
testOpt.ii
Below is the stdout/stderr for the compilation:
[michael@belly gcc_issues]$ g++ -v -save-temps -O1 testOpt.cpp -o testOpt
Using built-in specs.
Target: i586-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-ppl --with-cloog --with-tune=generic --with-arch=i586
--build=i586-redhat-linux
Thread model: posix
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-o' 'testOpt' '-shared-libgcc'
'-mtune=generic' '-march=i586'
/usr/libexec/gcc/i586-redhat-linux/4.4.1/cc1plus -E -quiet -v -D_GNU_SOURCE
testOpt.cpp -mtune=generic -march=i586 -O1 -fpch-preprocess -o testOpt.ii
ignoring nonexistent directory
"/usr/lib/gcc/i586-redhat-linux/4.4.1/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../../i586-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../../include/c++/4.4.1
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../../include/c++/4.4.1/i586-redhat-linux
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../../include/c++/4.4.1/backward
/usr/local/include
/usr/lib/gcc/i586-redhat-linux/4.4.1/include
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-o' 'testOpt' '-shared-libgcc'
'-mtune=generic' '-march=i586'
/usr/libexec/gcc/i586-redhat-linux/4.4.1/cc1plus -fpreprocessed testOpt.ii
-quiet -dumpbase testOpt.cpp -mtune=generic -march=i586 -auxbase testOpt -O1
-version -o testOpt.s
GNU C++ (GCC) version 4.4.1 20090725 (Red Hat 4.4.1-2) (i586-redhat-linux)
compiled by GNU C version 4.4.1 20090725 (Red Hat 4.4.1-2), GMP version
4.2.4, MPFR version 2.4.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e983968af33489f00d517096be08dea1
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-o' 'testOpt' '-shared-libgcc'
'-mtune=generic' '-march=i586'
as -V -Qy -o testOpt.o testOpt.s
GNU assembler version 2.19.51.0.14 (i586-redhat-linux) using BFD version
version 2.19.51.0.14-1.fc11 20090722
COMPILER_PATH=/usr/libexec/gcc/i586-redhat-linux/4.4.1/:/usr/libexec/gcc/i586-redhat-linux/4.4.1/:/usr/libexec/gcc/i586-redhat-linux/:/usr/lib/gcc/i586-redhat-linux/4.4.1/:/usr/lib/gcc/i586-redhat-linux/:/usr/libexec/gcc/i586-redhat-linux/4.4.1/:/usr/libexec/gcc/i586-redhat-linux/:/usr/lib/gcc/i586-redhat-linux/4.4.1/:/usr/lib/gcc/i586-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/i586-redhat-linux/4.4.1/:/usr/lib/gcc/i586-redhat-linux/4.4.1/:/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O1' '-o' 'testOpt' '-shared-libgcc'
'-mtune=generic' '-march=i586'
/usr/libexec/gcc/i586-redhat-linux/4.4.1/collect2 --eh-frame-hdr --build-id -m
elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -o testOpt
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../crt1.o
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../crti.o
/usr/lib/gcc/i586-redhat-linux/4.4.1/crtbegin.o
-L/usr/lib/gcc/i586-redhat-linux/4.4.1 -L/usr/lib/gcc/i586-redhat-linux/4.4.1
-L/usr/lib/gcc/i586-redhat-linux/4.4.1/../../.. testOpt.o -lstdc++ -lm -lgcc_s
-lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/i586-redhat-linux/4.4.1/crtend.o
/usr/lib/gcc/i586-redhat-linux/4.4.1/../../../crtn.o
--
Summary: -O1 optimisation of for loops in some cases omits
essential functionality resulting in failed applications
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mhenson at clarityvi dot com
GCC target triplet: i586-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41287