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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-14
            Summary|[15 Regression] wrong code  |[15 Regression] wrong code
                   |at -O2/O3 when compiled     |at -O2/O3
                   |with -fPIC                  |
           Keywords|                            |needs-bisection
     Ever confirmed|0                           |1
   Target Milestone|---                         |15.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. -fPIC is just forces f to not to be inlined.
Here is a testcase which fails at -O2 but passes at -O0/-O1:
```
int a = 2, b=0, *c = &a, *d = &a, e=0;
[[gnu::noipa]]
void f(int) {}
[[gnu::noinline]]
int h(int *k) {
  int ***j;
  if (b) {
    *j = &k; // Note the unintialized j is used here
             // but since it is conditional and b is always zero, there should
no
             // effect otherwise.
    ***j;
  }
  f(*k);
  *d = e;
  return *k;
}
int main() { if (h(c)) __builtin_abort(); }
```

Reply via email to