This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults


>Number:         8988
>Category:       optimization
>Synopsis:       gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 18 04:36:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Kevin Easton
>Release:        gcc version 3.2.1
>Organization:
>Environment:
Reading specs from /home/kevin/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs
Configured with: ./configure --prefix=/home/kevin
Thread model: posix
gcc version 3.2.1
>Description:

When the attached correct code is compiled with gcc 3.2 or 3.2.1, with -mcpu=i386 (anything up to -mcpu=i586 will reproduce it), and -O2 optimisation level (both lower and higher optimisation levels do not produce the bug), it segfaults.

The assembly code produced attempts to read from memory location 0x00000001.

Even modifications as small as removing the function call that does nothing will stop the bug from happening.
>How-To-Repeat:
gcc -Wall -O2 -mcpu=i386 -g gcc-bug.c -o gcc-bug
[kevin@indy cutdown]$ gdb ./gcc-bug
...
Program received signal SIGSEGV, Segmentation fault.
0x0804835a in main (argc=1, argv=0xbffffad4) at gcc-bug.c:12
12              ptr++;
>Fix:
Compiling with -fno-strength-reduce -O2 fixes the problem, compiling with -O1 or lower fixes the problem, compiling with -O2 -mcpu=i686 or higher fixes the problem.  The latest gcc 3.3 snapshot does not exhibit the problem.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]