public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
@ 2002-12-18  5:46 caf
  0 siblings, 0 replies; 4+ messages in thread
From: caf @ 2002-12-18  5:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/8988; it has been noted by GNATS.

From: caf@guarana.org
To: paolo@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	kevin@sylandro.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
Date: Thu, 19 Dec 2002 00:37:16 +1100

 On Wed, Dec 18, 2002 at 12:54:39PM -0000, paolo@gcc.gnu.org wrote:
 > Synopsis: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: paolo
 > State-Changed-When: Wed Dec 18 04:54:38 2002
 > State-Changed-Why:
 >     For some reason, the attachment got lost. Could you possibly
 >     provide it again?
 >     Thanks, Paolo.
 > 
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8988
 
 Preprocessed output attached.
 
 By the way, the bad assembly that causes the crash is:
 
 .L8:
         leal    1(%ecx), %edx
         xorl    %ecx, %ecx		; %ecx is 0
         .p2align 2,,3
 .L7:
         movl    %edx, %eax
         movl    %edx, -28(%ebp)
         leal    2(%ecx), %edx		; %edx is 2
         movl    %eax, %ecx
         movb    -1(%edx), %al		; we try to read from 0x00000001
 
 	- Kevin.
 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
@ 2002-12-18  5:46 caf
  0 siblings, 0 replies; 4+ messages in thread
From: caf @ 2002-12-18  5:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/8988; it has been noted by GNATS.

From: caf@guarana.org
To: paolo@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	kevin@sylandro.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
Date: Thu, 19 Dec 2002 00:38:19 +1100

 --y0ulUmNC+osPPQO6
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Wed, Dec 18, 2002 at 12:54:39PM -0000, paolo@gcc.gnu.org wrote:
 > Synopsis: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: paolo
 > State-Changed-When: Wed Dec 18 04:54:38 2002
 > State-Changed-Why:
 >     For some reason, the attachment got lost. Could you possibly
 >     provide it again?
 >     Thanks, Paolo.
 
 *Oops* :)
 
 Preprocessed output *really* attached this time.  Sorry about that :)
 
 	- Kevin.
 
 
 --y0ulUmNC+osPPQO6
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="smeg.i"
 
 # 1 "smeg.c"
 # 1 "<built-in>"
 # 1 "<command line>"
 # 1 "smeg.c"
 void next_arg(char *p1, char **p2)
 {
 }
 
 int main(int argc, char *argv[])
 {
     char str[] = "foo { xx }";
     char *ptr = str + 5;
 
     next_arg(ptr, &ptr);
     while (*ptr && (*ptr == 13 || *ptr == 32))
         ptr++;
     return 0;
 }
 
 --y0ulUmNC+osPPQO6--


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
@ 2002-12-18  4:54 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2002-12-18  4:54 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, kevin, nobody

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

State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Wed Dec 18 04:54:38 2002
State-Changed-Why:
    For some reason, the attachment got lost. Could you possibly
    provide it again?
    Thanks, Paolo.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8988


^ permalink raw reply	[flat|nested] 4+ messages in thread

* optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults
@ 2002-12-18  4:36 kevin
  0 siblings, 0 replies; 4+ messages in thread
From: kevin @ 2002-12-18  4:36 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-12-18 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-18  5:46 optimization/8988: gcc3.2 and 3.2.1 with -O2 and -mcpu=i386 generates code that segfaults caf
  -- strict thread matches above, loose matches on Subject: below --
2002-12-18  5:46 caf
2002-12-18  4:54 paolo
2002-12-18  4:36 kevin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).