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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
            Summary|wrong code with '-O3        |[14 Regression] wrong code
                   |-fno-inline-functions-calle |with '-O3
                   |d-once                      |-fno-inline-functions-calle
                   |-fno-inline-small-functions |d-once
                   |-fno-omit-frame-pointer     |-fno-inline-small-functions
                   |-fno-toplevel-reorder       |-fno-omit-frame-pointer
                   |-fno-tree-fre'              |-fno-toplevel-reorder
                   |                            |-fno-tree-fre'
   Last reconfirmed|                            |2023-10-10
          Component|c                           |tree-optimization
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
PRE does:

Processing block 0: BB2
Value numbering stmt = *m_1(D) = &e;
RHS &e simplified to &e
No store match
Value numbering store *m_1(D) to &e
Setting value number of .MEM_3 to .MEM_

...

Starting insert iteration 1
Deleted redundant store *m_1(D) = &e;
Removing dead stmt *m_1(D) = &e;


Better reduced testcase:
```
struct a {};
struct {
  unsigned b;
  unsigned short c;
} d, f = {9, 1};
int e;
static void g(unsigned, __SIZE_TYPE__, int **m);
static void h() {
  int *i = &e;
  g(0, (__SIZE_TYPE__)i, &i);
  if (*i)
    f = d;
}
void g(unsigned a, __SIZE_TYPE__ b, int **m) {
  *m = &e;
}
int main() {
  h();
  if (f.c != 1)
    __builtin_abort();
}
```

Reply via email to