https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105762
Bug ID: 105762
Summary: [12 Regression] -Warray-bounds false positives for
integer-to-pointer casts
Product: gcc
Version: 12.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: roland at gnu dot org
Target Milestone: ---
This code:
```
void crash(void) {
volatile int* ptr = (volatile int*)1ul;
*ptr = 1;
}
```
now gets:
```
warning: array subscript 0 is outside array bounds of 'volatile int[0]'
[-Warray-bounds]
```
This is a regression since GCC 11.
Reproduced on aarch64-elf and x86_64-elf targets as of 12 branch commit
2c11a9a380e7af333e19d6e576a889646d699b2a