From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31702 invoked by alias); 16 Dec 2003 16:01:42 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31695 invoked by uid 48); 16 Dec 2003 16:01:41 -0000 Date: Tue, 16 Dec 2003 16:07:00 -0000 From: "micis at gmx dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20031216160133.13411.micis@gmx.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/13411] New: segmentation fault occurs in correct code - optimisation problem at O2 X-Bugzilla-Reason: CC X-SW-Source: 2003-12/txt/msg01629.txt.bz2 List-Id: 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 occurs. 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 --enable-languages=c,c++,java,f77,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --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 Product: gcc Version: 3.3.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: optimization 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 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13411