From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17573 invoked by alias); 6 Jan 2003 13:36:22 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 17529 invoked by uid 71); 6 Jan 2003 13:36:21 -0000 Resent-Date: 6 Jan 2003 13:36:21 -0000 Resent-Message-ID: <20030106133621.17528.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, macklobell@hotmail.com Received: (qmail 14493 invoked by uid 61); 6 Jan 2003 13:31:25 -0000 Message-Id: <20030106133124.14481.qmail@sources.redhat.com> Date: Mon, 06 Jan 2003 13:36:00 -0000 From: macklobell@hotmail.com Reply-To: macklobell@hotmail.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/9185: gcc produces errornous code on cygwin host when -fomit-frame-pointer is used together with -O2 or -O3 X-SW-Source: 2003-01/txt/msg00324.txt.bz2 List-Id: >Number: 9185 >Category: c >Synopsis: gcc produces errornous code on cygwin host when -fomit-frame-pointer is used together with -O2 or -O3 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Jan 06 05:36:20 PST 2003 >Closed-Date: >Last-Modified: >Originator: macklobell@hotmail.com >Release: All >Organization: >Environment: $ uname -a CYGWIN_NT-5.1 VOLVO 1.3.18(0.69/3/2) 2002-12-25 15:37 i686 unknown unknown Cygwin $ echo $CC33 /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc $ $CC33 --version xgcc (GCC) 3.3 20030103 (prerelease) Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ as --version GNU assembler 2.13.90 20021118 Copyright 2002 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. This assembler was configured for a target of `i686-pc-cygwin'. $ ld --version GNU ld version 2.13.90 20021118 Copyright 2002 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. >Description: I came a cross this problem when building binutils. All logs/traces are from builds of the linker (ld.exe). The problem, if i build the linker with "-fomit-frame-pointer" together with -O2 or -O3 the executable will crash (segmentation fault). ld.exe always crash in the function parse_args(lexsup.c), so all logs attached are from that file. This might only be a cygwin problem. I did the same tests o n a FreeBSD machine and the executables work fine there. *** Working testcase. -fomit-frame-pointer with -O1 *** $ rm lexsup.[ios]; make CC="$CC33" CFLAGS="-g -O1 -fomit-frame-pointer -save-temps -dAP -Wa,-al h=mixed.log" && ./ld-new.exe -V make all-recursive make[1]: Entering directory `/home/lobell/build/native_binutils/ld' Making all in po make[2]: Entering directory `/home/lobell/build/native_binutils/ld/po' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/lobell/build/native_binutils/ld/po' make[2]: Entering directory `/home/lobell/build/native_binutils/ld' /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc -DHAVE_CON FIG_H -I. -I../../../src/binutils-2.13.1/ld -I. -D_GNU_SOURCE -I. -I../../../src/binutils-2.13.1 /ld -I../bfd -I../../../src/binutils-2.13.1/ld/../bfd -I../../../src/binutils-2.13.1/ld/../inclu de -I../../../src/binutils-2.13.1/ld/../intl -I../intl -g -O1 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mixed.log -DLOCALEDIR="\"/usr/local/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O1 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mixed.log -c ../../. ./src/binutils-2.13.1/ld/lexsup.c /bin/sh ./libtool --mode=link /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/buil d/native_gcc3.3/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O1 -fomit-frame-pointe r -save-temps -dAP -Wa,-alh=mixed.log -o ld-new.exe ldgram.o ldlex.o lexsup.o ldlang.o mri.o l dctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o ei386pe.o deffile p.o pe-dll.o ../bfd/libbfd.la ../libiberty/libiberty.a /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc -W -Wall - Wstrict-prototypes -Wmissing-prototypes -g -O1 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mi xed.log -o ld-new.exe ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp .o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o ei386pe.o deffilep.o pe-dll.o ../bfd/.libs/libbf d.a ../libiberty/libiberty.a make[2]: Leaving directory `/home/lobell/build/native_binutils/ld' make[1]: Leaving directory `/home/lobell/build/native_binutils/ld' GNU ld version 2.13.1 <- *** Working! *** Supported emulations: i386pe *** Not working testcase. -fomit-frame-pointer with -O2 *** $ rm lexsup.[ios]; make CC="$CC33" CFLAGS="-g -O2 -fomit-frame-pointer -save-temps -dAP -Wa,-al h=mixed.log" && ./ld-new.exe -V make all-recursive make[1]: Entering directory `/home/lobell/build/native_binutils/ld' Making all in po make[2]: Entering directory `/home/lobell/build/native_binutils/ld/po' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/lobell/build/native_binutils/ld/po' make[2]: Entering directory `/home/lobell/build/native_binutils/ld' /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc -DHAVE_CON FIG_H -I. -I../../../src/binutils-2.13.1/ld -I. -D_GNU_SOURCE -I. -I../../../src/binutils-2.13.1 /ld -I../bfd -I../../../src/binutils-2.13.1/ld/../bfd -I../../../src/binutils-2.13.1/ld/../inclu de -I../../../src/binutils-2.13.1/ld/../intl -I../intl -g -O2 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mixed.log -DLOCALEDIR="\"/usr/local/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mixed.log -c ../../. ./src/binutils-2.13.1/ld/lexsup.c /bin/sh ./libtool --mode=link /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/buil d/native_gcc3.3/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -fomit-frame-pointe r -save-temps -dAP -Wa,-alh=mixed.log -o ld-new.exe ldgram.o ldlex.o lexsup.o ldlang.o mri.o l dctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o ei386pe.o deffile p.o pe-dll.o ../bfd/libbfd.la ../libiberty/libiberty.a /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc -W -Wall - Wstrict-prototypes -Wmissing-prototypes -g -O2 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mi xed.log -o ld-new.exe ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp .o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o ei386pe.o deffilep.o pe-dll.o ../bfd/.libs/libbf d.a ../libiberty/libiberty.a make[2]: Leaving directory `/home/lobell/build/native_binutils/ld' make[1]: Leaving directory `/home/lobell/build/native_binutils/ld' Segmentation fault (core dumped) <- *** NOTE! *** *** Not working testcase. -fomit-frame-pointer and -O3 *** $ rm lexsup.[ios]; make CC="$CC33" CFLAGS="-g -O3 -fomit-frame-pointer -save-temps -dAP -Wa,-al h=mixed.log" && ./ld-new.exe -V make all-recursive make[1]: Entering directory `/home/lobell/build/native_binutils/ld' Making all in po make[2]: Entering directory `/home/lobell/build/native_binutils/ld/po' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/home/lobell/build/native_binutils/ld/po' make[2]: Entering directory `/home/lobell/build/native_binutils/ld' /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc -DHAVE_CON FIG_H -I. -I../../../src/binutils-2.13.1/ld -I. -D_GNU_SOURCE -I. -I../../../src/binutils-2.13.1 /ld -I../bfd -I../../../src/binutils-2.13.1/ld/../bfd -I../../../src/binutils-2.13.1/ld/../inclu de -I../../../src/binutils-2.13.1/ld/../intl -I../intl -g -O3 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mixed.log -DLOCALEDIR="\"/usr/local/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O3 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mixed.log -c ../../. ./src/binutils-2.13.1/ld/lexsup.c /bin/sh ./libtool --mode=link /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/buil d/native_gcc3.3/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O3 -fomit-frame-pointe r -save-temps -dAP -Wa,-alh=mixed.log -o ld-new.exe ldgram.o ldlex.o lexsup.o ldlang.o mri.o l dctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o ei386pe.o deffile p.o pe-dll.o ../bfd/libbfd.la ../libiberty/libiberty.a /home/lobell/build/native_gcc3.3/gcc/xgcc.exe -B /home/lobell/build/native_gcc3.3/gcc -W -Wall - Wstrict-prototypes -Wmissing-prototypes -g -O3 -fomit-frame-pointer -save-temps -dAP -Wa,-alh=mi xed.log -o ld-new.exe ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp .o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o ei386pe.o deffilep.o pe-dll.o ../bfd/.libs/libbf d.a ../libiberty/libiberty.a make[2]: Leaving directory `/home/lobell/build/native_binutils/ld' make[1]: Leaving directory `/home/lobell/build/native_binutils/ld' Segmentation fault (core dumped) <- *** NOTE! *** *** gdb output *** $ /usr/local/native/bin/gdb.exe ./ld-new.exe GNU gdb 5.3 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-cygwin"... (gdb) r Starting program: /home/lobell/build/native_binutils/ld/ld-new.exe Program received signal SIGSEGV, Segmentation fault. parse_args (argc=Cannot access memory at address 0x1051 ) at ../../../src/binutils-2.13.1/ld/lexsup.c:492 492 longopts[il] = ld_options[i].opt; (gdb) where #0 parse_args (argc=Cannot access memory at address 0x1051 ) at ../../../src/binutils-2.13.1/ld/lexsup.c:492 #1 0x77fa2aef in _libkernel32_a_iname () Cannot access memory at address 0x1 (gdb) I have done these tests with 3.3, 3.4 and 3.2, and the problem exists in all versions. I have attached the following files from a build with CFLAGS="-fomit-frame-pointer -O2": lexsup.s (-save-temps -dAP) mixed.log (-Wa,-alh=mixed.log) lexsup.c >How-To-Repeat: Build binutils 2.13.1 on a cygwin host with CFLAGS="-fomit-frame-pointer -O2". >Fix: >Release-Note: >Audit-Trail: >Unformatted: