Bug 150020 - GCC misoptimises loop with -Os
Summary: GCC misoptimises loop with -Os
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
(Show other bugs)
Version: rawhide
Hardware: powerpc Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-03-01 18:11 UTC by David Woodhouse
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version: 4.0.0-0.35
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-21 21:00:30 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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

Description David Woodhouse 2005-03-01 18:11:58 UTC
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)

Comment 1 Jakub Jelinek 2005-03-04 11:47:35 UTC
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 21:00:30 UTC
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.