https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121829
Bug ID: 121829
Summary: [Trunk] Trigger error at -O2/O3 during GIMPLE pass:
optimized
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: xxs_chy at outlook dot com
Target Milestone: ---
Testcase:
#include "stdint.h"
int32_t a[][1];
int32_t *b(int32_t *);
int32_t c() {
int32_t *d[4];
int32_t **e = &d[3];
int f;
for (; f; f++)
d[f] = &a[1][0];
b(*e);
}
int32_t *b(int32_t *g) {
asm goto("" : : : : h);
int32_t i[9];
h:
int f;
for (f = 0; f < 9; f++)
i[f] = 1;
*g = i[4];
}
Compile this testcase at O2/O3, causing a segmentation fault.
Reproducible link: https://godbolt.org/z/qfecb4WzE
The testcase is reduced and contains UB, but the original one is well-defined.