https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116835

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|phiprop will prop back into |[12/13/14/15 Regression]
                   |a loop                      |phiprop will prop back into
                   |                            |a loop
      Known to fail|                            |4.4.7
           Keywords|                            |wrong-code
      Known to work|                            |4.1.2

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Found a testcase which we produce wrong code as we introduce an unconditional
load:
```
extern int a __attribute__((weak));

int b;
int bar (int c) __attribute__((noipa, noinline));
int 
bar (int c)
{
  int *p = &a;
  for (int j = 0; j < c; ++j)
    p = &b;
  return *p;
}

int main(void)
{
 if (bar(100))
   __builtin_abort();
}
```

Compile this at -Os and you will see the load from a happens even though it is
weak.

Reply via email to