[Bug optimization/13411] New: segmentation fault occurs in correct code - optimisation problem at O2
micis at gmx dot de
Tue Dec 16 16:07:00 GMT 2003
A small function named SM33S destroys local variables which lead to an
segmentation fault when called twice.
This error occurs only when some printf statements are after the declaration
of variables and not at the beginning of the function.
Also the function works when the adresses of data accesses are checked.
It seems to be an optimisation problem since it occurs only at -O2 or higher.
At -O0 the compiler generates an internal compiler error, but I will submit
this in a different bug report.
This program is a test program for developing an altivec function. The
same operation is implemented in different ways (with and without altivec
code) and the results are compared.
If the altivec implementation is removed or returns immediately, SM33S
alters one of the loacal variables in main() but no segmentation error
I have tried to narrow this bug down, but if you change to much on that
program, the error will not occur.
output from gcc -v:
Reading specs from /usr/lib/gcc-lib/powerpc-linux/3.3.2/specs
Configured with: ../src/configure -v
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc --disable-multilib powerpc-linux
Thread model: posix
gcc version 3.3.2 (Debian)
gcc command line:
gcc -g -o matbug matbug.cpp -mcpu=7450 -maltivec -O2 -lstdc++ -Wall -pedantic -
lefence -save-temps -fverbose-asm
Summary: segmentation fault occurs in correct code - optimisation
problem at O2
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: micis at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: powerpc-linux
GCC target triplet: powerpc-linux
More information about the Gcc-bugs