From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26024 invoked by alias); 15 Jan 2006 07:02:33 -0000 Received: (qmail 25982 invoked by uid 48); 15 Jan 2006 07:02:29 -0000 Date: Sun, 15 Jan 2006 07:02:00 -0000 Subject: [Bug c/25791] New: -O2 execution fails using 3.4.4, -O and -g work X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dick_guertin at yahoo dot com" 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 X-SW-Source: 2006-01/txt/msg01412.txt.bz2 List-Id: ~> which gcc /usr/pubsw/bin/gcc elaine:~> gcc -v Reading specs from /afs/ir.stanford.edu/systems/@sys/pubsw/package/Languages/gcc-3.4.4/sun4x_58/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.4/specs Configured with: ../../gcc-3.4.4/configure --datadir=/lib --libexecdir=/lib --sharedstatedir=/lib --prefix=/usr/pubsw --enable-threads --with-gnu-as --with-as=/usr/pubsw/bin/as --with-gnu-ld --with-ld=/usr/pubsw/bin/ld --with-libintl- prefix=/usr/pubsw --with-libiconv-prefix=/usr/pubsw Thread model: posix gcc version 3.4.4 vine:~> gcc -v Reading specs from /afs/ir.stanford.edu/systems/i386_linux24/pubsw/package/Languages/gcc-3.4.4/i386_linux24/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs Configured with: ../../gcc-3.4.4/configure --datadir=/lib --libexecdir=/lib --sharedstatedir=/lib --prefix=/usr/pubsw --enable-threads --with-gnu-as --with-as=/usr/pubsw/bin/as --with-gnu-ld --with-ld=/usr/pubsw/bin/ld --with-libintl- prefix=/usr/pubsw --with-libiconv-prefix=/usr/pubsw Thread model: posix gcc version 3.4.4 This 'bug' appeared with the introduction of version 3.4.4. On all other platforms, the code compiles and executes properly. This includes Mac OSX on a G3 and G4, RedHat Linux on i386, and Solaris on Sun's sparc. This code is also shared between another i486 and sparc machine, as shown above. I deleted all objects (.o), and created a new Makefile using 'xmkmf' with an Imakefile. I then compile and built the target program with 'make'. The Makefile had -O2 optimization by default (created by xmkmf). When I tried to execute the target program, it failed, as follows: (gdb) run Starting program: /afs/ir.stanford.edu/users/g/u/guertin/wylsrc/wylbur.ge Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? () (gdb) where #0 0x00000000 in ?? () #1 0x0021ff6c in rlookup () #2 0x0021fbd8 in nscan () #3 0x00223778 in NSCAN () #4 0x00026d9c in EDTBASE () #5 0x000277c0 in EDTCOM () #6 0x00224348 in signon () #7 0x0001c418 in startpw () #8 0x00102070 in main () I started over, deleted all objects, and changed -O2 to -O in the Makefile. This version compiled and executed properly. The same was true when I tried -g in place of -O or -O2. So -O2 code fails to execute properly, but -O code works just fine. This same behaviour occurred on BOTH the i486 and sparc machines. The program is rather large: subdirectory 1: 1 .c, 1 .h subdirectory 2: 16 .c, 22 .h subdirectory 3: 6 .c, 11 .h maindir: 58 .c, 142 .h The program is 3353608 bytes in size on sparc. The program is 2928714 bytes in size on i486. An example of where -O2 code compiles and executes PROPERLY is: liblin1 $ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-39) But on the i486 and sparc machines listed at the beginning, -O2 code fails to execute properly. -- Summary: -O2 execution fails using 3.4.4, -O and -g work Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: major Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dick_guertin at yahoo dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25791