From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7647 invoked by alias); 16 Jan 2006 23:16:04 -0000 Received: (qmail 7630 invoked by uid 48); 16 Jan 2006 23:16:02 -0000 Date: Mon, 16 Jan 2006 23:16:00 -0000 Message-ID: <20060116231602.7629.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/25791] -O2 execution fails, -O and -g work In-Reply-To: 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/msg01594.txt.bz2 List-Id: ------- Comment #2 from dick_guertin at yahoo dot com 2006-01-16 23:16 ------- See my response below yours. --- ebotcazou at gcc dot gnu dot org wrote: > > > ------- Comment #1 from ebotcazou at gcc dot gnu dot > org 2006-01-15 10:01 ------- > We cannot do anything without a reproducer. See > http://gcc.gnu.org/bugs.html. > > However, a segfault at runtime on several platforms > with -O2 and not -O1 may > hint at an aliasing problem in the code. You could > try to recompile everything > with -O2 -fno-strict-aliasing and see what happens. > Read the -fstrict-aliasing > entry in the manual, section Optimize Options, for > more information. > > > -- > > ebotcazou at gcc dot gnu dot org changed: > > What |Removed > |Added > ---------------------------------------------------------------------------- > CC| > |ebotcazou at gcc dot gnu dot > | |org > Severity|major > |normal > Status|UNCONFIRMED > |WAITING > Summary|-O2 execution fails using |-O2 > execution fails, -O and > |3.4.4, -O and -g work |-g > work > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25791 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. > I tried what you said, adding -fno-strict-aliasing to my DEFINES statement in the Imakefile. I then removed all object decks, private libraries, and the Makefiles, and used 'xmkmf' to rebuild them . I then compiled the three sub-libraries, and then the main code. All were done with -O2 and -fno-strict-aliasing. Execution then went like this: elaine30:~/wylsrc> gdb wylbur.ge GNU gdb 6.3 Copyright 2004 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 "sparc-sun-solaris2.8"... (gdb) run Starting program: /afs/ir.stanford.edu/users/g/u/guertin/wylsrc/wylbur.ge Program received signal SIGILL, Illegal instruction. 0x00297064 in hex_to_character () (gdb) where #0 0x00297064 in hex_to_character () #1 0x00297068 in hex_to_character () Previous frame identical to this frame (corrupt stack?) As you can see, your suggested change did NOT fix the 'problem'. What is obvious to me is that -O2 is affecting address computations. There shouldn't be any way to clobber the stack unless addresses are mis-computed or not stored into variables when they should. As far as I'm concerned, -O2 is a violation of the ISO standards concerning Optimization. If you need the source code, I can bundle it into a tar.z file and make it available for download over the web. I would include a Readme file that explains what MINOR changes you would have to make to the Imakefile because this program expects to 'read' tables and initialization information from files stored in user-owned subdirectories (the user being YOU, the one who compiles the code). This is done so that this cade can be transported to different sites, owned by different users. By the way, I will include 'Imakefile.unix' and 'Imakefile.linux' files for all three subdirectories and the main code. That will allow you to compare Big-Endian to Little-Endian. Let me know what you want me to do next. I'd like to see this -O2 problem fixed! -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25791