public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/6080: incorrect loop optimizations
@ 2002-12-11 13:56 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2002-12-11 13:56 UTC (permalink / raw)
To: anders.blomdell, gcc-bugs, gcc-prs, nobody
Synopsis: incorrect loop optimizations
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Wed Dec 11 13:56:00 2002
State-Changed-Why:
I could reproduce the behavior with gcc3.0.4, but it
seems fixed with 3.2 where the assembler code for
both functions is essentially the same and correct.
Same applies to 3.3CVS.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6080
^ permalink raw reply [flat|nested] 2+ messages in thread
* optimization/6080: incorrect loop optimizations
@ 2002-03-28 2:56 anders.blomdell
0 siblings, 0 replies; 2+ messages in thread
From: anders.blomdell @ 2002-03-28 2:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 6080
>Category: optimization
>Synopsis: incorrect loop optimizations
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Mar 28 02:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Anders Blomdell <anders.blomdell@control.lth.se>
>Release: 3.0.4
>Organization:
>Environment:
System: Linux aljazari 2.4.13-KURT #2 Thu Nov 8 10:49:33 CET 2001 i686 unknown
Architecture: i686
<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: m68k-unknown-elf
configured with: ../../../gcc-3.0.4/configure --prefix=/usr/local/packages/cross
/m68k-elf --target=m68k-elf --with-newlib : (reconfigured) ../../../gcc-3.0.4/co
nfigure --prefix=/usr/local/packages/cross/m68k-elf --target=m68k-elf --with-new
lib : (reconfigured) ../../../gcc-3.0.4/configure --with-gcc-version-trigger=/wo
rk/aljazari2/andersb/gnu/gcc-3.0.4/gcc/version.c --host=i686-pc-linux-gnu --pref
ix=/usr/local/packages/cross/m68k-elf --target=m68k-elf --with-newlib --enable-c
hecking=misc,tree,rtl,gc,gcac
>Description:
gcc -O5 makes incorrect loop optimizations on the following code:
// case A: h get called infinite times
static void ug0(unsigned int count)
{
while (count > 0) { ug0(0); h(); count--; }
}
void uf0() { ug0(1000); }
// case B: h gets called only once
static void sg0(int count)
{
while (count > 0) { sg0(0); h(); count--; }
}
void sf0() { sg0(1000); }
This is the m68k code that gets produced (ppc code exhibits same problem...)
80000128 <uf0>:
80000128: 4e56 0000 linkw %fp,#0
8000012c: 42a7 clrl %sp@-
8000012e: 6120 bsrs 80000150 <ug0>
80000130: 61ff ffff ffda bsrl 8000010c <h>
80000136: 588f addql #4,%sp
80000138: 60f2 bras 8000012c <uf0+0x4>
8000013a: 4e71 nop
8000013c <sf0>:
8000013c: 4e56 0000 linkw %fp,#0
80000140: 42a7 clrl %sp@-
80000142: 6130 bsrs 80000174 <sg0>
80000144: 61ff ffff ffc6 bsrl 8000010c <h>
8000014a: 588f addql #4,%sp
8000014c: 4e5e unlk %fp
8000014e: 4e75 rts
>How-To-Repeat:
Compile the testprogram with -O5
>Fix:
Turn off optimization
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-12-11 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-11 13:56 optimization/6080: incorrect loop optimizations bangerth
-- strict thread matches above, loose matches on Subject: below --
2002-03-28 2:56 anders.blomdell
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).