When compiling attached unit test with -O3, it fails on sse2 test.  With any
other optimization  level including -O2 plus: 
   -fgcse-after-reload    
   -finline-functions     
   -fipa-cp-clone         
   -fpredictive-commoning -ftree-vectorize       
   -funswitch-loops
which should be the same as -O3, it passes unit test succesfully. 

Gentoo x86_64, with  gcc-4.4 and 4.3.2
Project page: http://volnitsky/project/lvvlib
Source: http://github.com/lvv/lvvlib
u-array.ii.gz attached. 

---------------------------------------------------------
g++      u-array.cc -o u-array     -Wall
-DID='"081214_183302-��g++-4.4.0-OPTIMIZE-0e541970++M"'   -I ~/p/  -I
/usr/local/include -DNDEBUG  -DGSL_RANGE_CHECK_OFF -DNOCHECK   -pipe
-Wno-reorder -Wno-sign-compare  -O3 -march=native  -fwhole-program --combine 
-fopenmp -fomit-frame-pointer -funsafe-loop-optimizations  -DGCC_BUG -O3 -v  
-Wno-unused-variable -Wno-unused-variable  
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure : (reconfigured) ./configure --disable-bootstrap
--enable-languages=c,c++,fortran --enable-multilib
Thread model: posix
gcc version 4.4.0 20081208 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-o' 'u-array' '-Wall'
'-DID="081214_183302-��g++-4.4.0-OPTIMIZE-0e541970++M"' '-I' '/home/lvv/p/'
'-I' '/usr/local/include' '-DNDEBUG' '-DGSL_RANGE_CHECK_OFF' '-DNOCHECK'
'-pipe' '-Wno-reorder' '-Wno-sign-compare' '-O3'  '-fwhole-program' '-combine'
'-fopenmp' '-fomit-frame-pointer' '-funsafe-loop-optimizations' '-DGCC_BUG'
'-O3' '-v' '-Wno-unused-variable' '-shared-libgcc' '-pthread'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/cc1plus -quiet -v -I
/home/lvv/p/ -I /usr/local/include -D_GNU_SOURCE -D_REENTRANT
-DID="081214_183302-��g++-4.4.0-OPTIMIZE-0e541970++M" -DNDEBUG
-DGSL_RANGE_CHECK_OFF -DNOCHECK -DGCC_BUG u-array.cc -march=core2 -mcx16 -msahf
--param l1-cache-size=32 --param l1-cache-line-size=64 --param
l2-cache-size=4096 -mtune=core2 -quiet -dumpbase u-array.cc -auxbase u-array
-O3 -O3 -Wall -Wno-reorder -Wno-sign-compare -Wno-unused-variable -version
-fwhole-program -fopenmp -fomit-frame-pointer -funsafe-loop-optimizations -o -
|
 as -V -Qy -o /tmp/ccO8IZrX.o -
GNU assembler version 2.18 (x86_64-pc-linux-gnu) using BFD version (GNU
Binutils) 2.18
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../x86_64-unknown-linux-gnu/include"
ignoring duplicate directory "/usr/local/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/usr/local/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /home/lvv/p/

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../include/c++/4.4.0

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../include/c++/4.4.0/x86_64-unknown-linux-gnu

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../include/c++/4.4.0/backward
 /usr/local/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.4.0 20081208 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.0 20081115 (experimental), GMP version
4.2.4, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: f0165b2e8081c04e24b530c99a2b0b81
COMPILER_PATH=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/:/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/usr/local/lib/../lib64/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/usr/local/lib/:/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../:/lib/:/usr/lib/
Reading specs from /usr/local/lib/../lib64/libgomp.spec
COLLECT_GCC_OPTIONS='-o' 'u-array' '-Wall'
'-DID="081214_183302-��g++-4.4.0-OPTIMIZE-0e541970++M"' '-I' '/home/lvv/p/'
'-I' '/usr/local/include' '-DNDEBUG' '-DGSL_RANGE_CHECK_OFF' '-DNOCHECK'
'-pipe' '-Wno-reorder' '-Wno-sign-compare' '-O3'  '-fwhole-program' '-combine'
'-fopenmp' '-fomit-frame-pointer' '-funsafe-loop-optimizations' '-DGCC_BUG'
'-O3' '-v' '-Wno-unused-variable' '-shared-libgcc' '-pthread'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.4.0/collect2 --eh-frame-hdr
-m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o u-array
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/crtbegin.o
-L/usr/local/lib/../lib64 -L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64 -L. -L/usr/local/lib
-L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/../../.. /tmp/ccO8IZrX.o
-lstdc++ -lm -lgomp -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/crtend.o
/usr/lib/../lib64/crtn.o


-- 
           Summary: sse2(int16) code fails with -O3
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: leonid at volnitsky dot com
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38525

Reply via email to