Bug 229366 - CSE regression
Summary: CSE regression
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 5
Hardware: i686
OS: Linux
medium
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-20 17:28 UTC by dann
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-02-21 20:50:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch that fixes the bug in 4.1 (1.55 KB, patch)
2007-03-08 10:05 UTC, Alexandre Oliva
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 30643 0 None None None Never

Description dann 2007-02-20 17:28:09 UTC
Compiling this code with -O2 -S
struct s {  int a;  int b;};
void bar (struct s *ps,  int *p, int *__restrict__ rp, int *__restrict__ rq)
{
  ps->a = 0;
  ps->b = 1;
  if (ps->a != 0)    abort ();
  p[0] = 0;
  p[1] = 1;
  if (p[0] != 0)     abort ();
  rp[0] = 0;
  rq[0] = 1;
  if (rp[0] != 0)     abort();
}
should eliminate all the "abort" calls. 
and it does happen with: GCC: (GNU) 4.1.1 20060525 (Red Hat 4.1.1-1)

but GCC: (GNU) 4.1.1 20070105 (Red Hat 4.1.1-51) generates:

        .file   "t.c"
        .text
        .p2align 4,,15
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    8(%ebp), %eax
        movl    12(%ebp), %edx
        movl    16(%ebp), %ecx
        movl    $0, (%eax)
        movl    $1, 4(%eax)
        movl    (%eax), %eax
        testl   %eax, %eax
        jne     .L10
        movl    $0, (%edx)
        movl    $1, 4(%edx)
        movl    (%edx), %edx
        testl   %edx, %edx
        jne     .L10
        movl    20(%ebp), %eax
        movl    $0, (%ecx)
        movl    $1, (%eax)
        movl    (%ecx), %eax
        testl   %eax, %eax
        jne     .L10
        leave
        ret
.L10:
        call    abort
        .size   bar, .-bar
        .ident  "GCC: (GNU) 4.1.1 20070105 (Red Hat 4.1.1-51)"

This is PR30643 for gcc mainline. It seems that it somehow got backported to
4.1.1-51.

Comment 1 Jakub Jelinek 2007-02-21 20:50:56 UTC
This isn't Fedora gcc specific problem, tracking it just upstream is enough,
when it is fixed there it will show up in Fedora gcc very soon.

Comment 2 Alexandre Oliva 2007-03-08 10:05:07 UTC
Created attachment 149557 [details]
Patch that fixes the bug in 4.1

Trunk needs more than this, but this patch fixes the bug in 4.1.

Comment 3 Jakub Jelinek 2007-03-13 13:52:21 UTC
Should be fixed in gcc-4.1.2-4 in rawhide.


Note You need to log in before you can comment on or make changes to this bug.