[Bug tree-optimization/17133] New: [3.5 Regression] wrong code with -ftree-loop-optimize

belyshev at lubercy dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 21 20:58:00 GMT 2004


use '-O1' to repeat:
------------------------------------------------------------------------------
extern void abort (void);

int foo = 0;
void *bar = 0;
unsigned int baz = 100;

void *pure_alloc ()
{
  void *res;
  
  while (1)
    {
      res = (void *) ((((unsigned int) (foo + bar))) & ~1);
      foo += 2;
      if (foo < baz)
	return res;
      foo = 0;
    }
}

int main ()
{
  pure_alloc ();
  if (!foo)
    abort ();
  return 0;
}
------------------------------------------------------------------------------

-- 
           Summary: [3.5 Regression] wrong code with -ftree-loop-optimize
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: belyshev at lubercy dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17133



More information about the Gcc-bugs mailing list