public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/10593: -O2 dead-code optimization removes the wrong code
@ 2003-05-02 0:33 bangerth
0 siblings, 0 replies; 6+ messages in thread
From: bangerth @ 2003-05-02 0:33 UTC (permalink / raw)
To: bkuschak, gcc-bugs, gcc-prs, nobody
Synopsis: -O2 dead-code optimization removes the wrong code
State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Fri May 2 00:33:47 2003
State-Changed-Why:
2.95 is a very old release. Can you say anything about
whether the problem still occurs with newer versions of
gcc?
Thanks
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10593
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: optimization/10593: -O2 dead-code optimization removes the wrong code
@ 2003-05-02 0:54 bangerth
0 siblings, 0 replies; 6+ messages in thread
From: bangerth @ 2003-05-02 0:54 UTC (permalink / raw)
To: bkuschak, gcc-bugs, gcc-prs, nobody
Synopsis: -O2 dead-code optimization removes the wrong code
State-Changed-From-To: feedback->closed
State-Changed-By: bangerth
State-Changed-When: Fri May 2 00:54:34 2003
State-Changed-Why:
No, sorry, I missed the "Fix" field. I fear, you're out
of luck: we just abandoned the 3.2 branch, and before that
the 3.0 branch. Nobody's going to fix bugs in 2.95 any more,
unless -- maybe -- being paid for that. In any case, I
don't think we should keep open bug reports for things we
know are working now.
Sorry
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10593
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: optimization/10593: -O2 dead-code optimization removes the wrong code
@ 2003-05-02 0:46 Brian Kuschak
0 siblings, 0 replies; 6+ messages in thread
From: Brian Kuschak @ 2003-05-02 0:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10593; it has been noted by GNATS.
From: Brian Kuschak <bkuschak@yahoo.com>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: optimization/10593: -O2 dead-code optimization removes the wrong code
Date: Thu, 1 May 2003 17:38:46 -0700 (PDT)
Read the 'Fix' field.
--- bangerth@dealii.org wrote:
> Synopsis: -O2 dead-code optimization removes the
> wrong code
>
> State-Changed-From-To: open->feedback
> State-Changed-By: bangerth
> State-Changed-When: Fri May 2 00:33:47 2003
> State-Changed-Why:
> 2.95 is a very old release. Can you say anything
> about
> whether the problem still occurs with newer
> versions of
> gcc?
>
> Thanks
> Wolfgang
>
>
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10593
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: optimization/10593: -O2 dead-code optimization removes the wrong code
@ 2003-05-02 0:46 Brian Kuschak
0 siblings, 0 replies; 6+ messages in thread
From: Brian Kuschak @ 2003-05-02 0:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10593; it has been noted by GNATS.
From: Brian Kuschak <bkuschak@yahoo.com>
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: optimization/10593: -O2 dead-code optimization removes the wrong code
Date: Thu, 1 May 2003 17:38:10 -0700 (PDT)
Did you read the 'Fix' field?
--- gcc-gnats@gcc.gnu.org wrote:
> Thank you very much for your problem report.
> It has the internal identification
> `optimization/10593'.
> The individual assigned to look at your
> report is: unassigned.
>
> >Category: optimization
> >Responsible: unassigned
> >Synopsis: -O2 dead-code optimization removes
> the wrong code
> >Arrival-Date: Fri May 02 00:26:00 UTC 2003
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: optimization/10593: -O2 dead-code optimization removes the wrong code
@ 2003-05-02 0:46 Andrew Pinski
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Pinski @ 2003-05-02 0:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/10593; it has been noted by GNATS.
From: Andrew Pinski <pinskia@physics.uc.edu>
To: bangerth@dealii.org, bkuschak@yahoo.com, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc: Andrew Pinski <pinskia@physics.uc.edu>
Subject: Re: optimization/10593: -O2 dead-code optimization removes the wrong code
Date: Thu, 1 May 2003 20:40:51 -0400
Did you read the fix part:
Problem does not occur with gcc-3.2.=A0 But I really want to fix this in =
=20
2.95.3.
Thanks,
Andrew Pinski
On Thursday, May 1, 2003, at 20:33 US/Eastern, bangerth@dealii.org =20
wrote:
> Synopsis: -O2 dead-code optimization removes the wrong code
>
> State-Changed-From-To: open->feedback
> State-Changed-By: bangerth
> State-Changed-When: Fri May 2 00:33:47 2003
> State-Changed-Why:
> 2.95 is a very old release. Can you say anything about
> whether the problem still occurs with newer versions of
> gcc?
>
> Thanks
> Wolfgang
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20audit-=20
> trail&database=3Dgcc&pr=3D10593
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* optimization/10593: -O2 dead-code optimization removes the wrong code
@ 2003-05-02 0:26 bkuschak
0 siblings, 0 replies; 6+ messages in thread
From: bkuschak @ 2003-05-02 0:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 10593
>Category: optimization
>Synopsis: -O2 dead-code optimization removes the wrong code
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri May 02 00:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Brian Kuschak
>Release: 2.95.3
>Organization:
>Environment:
Linux x86 to powerpc cross compiler gcc 2.95.3, binutils 2.11. Also occurs on Solaris to powerpc cross.
>Description:
-O2 or -Os dead code optimization generates the wrong code for powerpc-linux. Some instructions which should be removed are not removed, and some instructions which should remain, are removed. With -O1, code generation is correct. See example in How-To-Repeat section.
>How-To-Repeat:
#include <stdio.h>
static void func(int a, int b)
{
int err;
unsigned int port;
switch (b) {
case 0:
case 1:
err = 1;
break;
case 2:
case 3:
err = 2;
break;
case 4:
default:
err = 3;
}
for (port = 0; port < 5; port++)
printf("port: %d\n", port);
}
With -O2, broken:
static void func(int a, int b)
{
0: 94 21 ff f0 stwu r1,-16(r1)
4: 7c 08 02 a6 mflr r0
8: 93 e1 00 0c stw r31,12(r1)
c: 90 01 00 14 stw r0,20(r1)
int err;
unsigned int port;
switch (b) {
10: 28 04 00 04 cmplwi r4,4 <=== should be removed
case 0:
case 1:
err = 1;
break;
case 2:
case 3:
err = 2;
break;
case 4:
default:
err = 3;
}
for (port = 0; port < 5; port++)
<=== the loop count (r31) initialization is missing here
printf("port: %d\n", port);
14: 3c 60 00 00 lis r3,0
18: 7f e4 fb 78 mr r4,r31
1c: 38 63 00 00 addi r3,r3,0
20: 48 00 00 01 bl 20 <func+0x20>
24: 3b ff 00 01 addi r31,r31,1
28: 28 1f 00 04 cmplwi r31,4
2c: 40 81 ff e8 ble 14 <func+0x14>
}
30: 80 01 00 14 lwz r0,20(r1)
34: 7c 08 03 a6 mtlr r0
38: 83 e1 00 0c lwz r31,12(r1)
3c: 38 21 00 10 addi r1,r1,16
40: 4e 80 00 20 blr
With -O1:
static void func(int a, int b)
{
0: 94 21 ff f0 stwu r1,-16(r1)
4: 7c 08 02 a6 mflr r0
8: 93 c1 00 08 stw r30,8(r1)
c: 93 e1 00 0c stw r31,12(r1)
10: 90 01 00 14 stw r0,20(r1)
int err;
unsigned int port;
switch (b) {
14: 28 04 00 04 cmplwi r4,4
18: 41 81 00 28 bgt 40 <func+0x40>
1c: 3d 20 00 00 lis r9,0
20: 39 29 00 10 addi r9,r9,16
24: 54 80 10 3a rlwinm r0,r4,2,0,29
28: 7c 09 00 2e lwzx r0,r9,r0
2c: 3d 20 00 00 lis r9,0
30: 39 29 00 10 addi r9,r9,16
34: 7c 00 4a 14 add r0,r0,r9
38: 7c 09 03 a6 mtctr r0
3c: 48 00 00 04 b 40 <func+0x40>
case 0:
case 1:
err = 1;
break;
case 2:
case 3:
err = 2;
break;
case 4:
default:
err = 3;
}
for (port = 0; port < 5; port++)
40: 3b e0 00 00 li r31,0
44: 3f c0 00 00 lis r30,0
printf("port: %d\n", port);
48: 38 7e 00 00 addi r3,r30,0
4c: 7f e4 fb 78 mr r4,r31
50: 48 00 00 01 bl 50 <func+0x50>
54: 3b ff 00 01 addi r31,r31,1
58: 28 1f 00 04 cmplwi r31,4
5c: 40 81 ff ec ble 48 <func+0x48>
}
60: 80 01 00 14 lwz r0,20(r1)
64: 7c 08 03 a6 mtlr r0
68: 83 c1 00 08 lwz r30,8(r1)
6c: 83 e1 00 0c lwz r31,12(r1)
70: 38 21 00 10 addi r1,r1,16
74: 4e 80 00 20 blr
>Fix:
Problem does not occur with gcc-3.2. But I really want to fix this in 2.95.3.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-05-02 0:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-02 0:33 optimization/10593: -O2 dead-code optimization removes the wrong code bangerth
-- strict thread matches above, loose matches on Subject: below --
2003-05-02 0:54 bangerth
2003-05-02 0:46 Andrew Pinski
2003-05-02 0:46 Brian Kuschak
2003-05-02 0:46 Brian Kuschak
2003-05-02 0:26 bkuschak
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).