Bug 150020 - GCC misoptimises loop with -Os
GCC misoptimises loop with -Os
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
rawhide
powerpc Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-01 13:11 EST by David Woodhouse
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version: 4.0.0-0.35
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-21 16:00:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 20290 None None None Never

  None (edit)
Description David Woodhouse 2005-03-01 13:11:58 EST
Build this with -Os on ppc32. It doesn't initialise l[256].

int main(void)
{
  int i;
  unsigned l[288];

  /* set up literal table */
  for (i = 0; i < 144; i++)
    l[i] = 8;
  for (; i < 256; i++)
    l[i] = 9;
  for (; i < 280; i++)
    l[i] = 7;
  for (; i < 288; i++)
    l[i] = 8;


  printf("%d\n", l[256]);
  if (l[256] != 7)
	  printf("oops.\n");
}
Comment 1 Jakub Jelinek 2005-03-04 06:47:35 EST
This is a bad bug, old loop.c now plays even with loops it doesn't fully
understand and doesn't take into account whether a value is increased in header,
body or latch of the loop.
Comment 2 Jakub Jelinek 2005-03-21 16:00:30 EST
Should be fixed in gcc-4.0.0-0.35.

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