[Bug middle-end/96564] [12/13/14/15 Regression] New maybe use of uninitialized variable warning since r11-959

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 10 02:35:23 GMT 2025


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

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So after r15-580, we can optimize:
```
extern void* malloc (long unsigned int);
void fun (unsigned *x) {
  if (x == 0)  
    __builtin_unreachable();
  unsigned *a = malloc (*x);
  if (a == 0)
    return;
  if (a != x)
    *a = *x;
  *x = *a;
}
```

But it can't handle:
```
extern void* malloc (long unsigned int);
void fun (unsigned *x) {
  if (x == 0)  
    return;
  unsigned *a = malloc (*x);
  if (a == 0)
    return;
  if (a != x)            // (A)
    *a = *x;
  *x = *a;
}
```


More information about the Gcc-bugs mailing list