https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120654
Bug ID: 120654
Summary: Crash at -O3: during GIMPLE pass: ivopts
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: yunboni at smail dot nju.edu.cn
Target Milestone: ---
This code crashes at -O3:
```c
int a, c, e, f, h, j;
long g, k;
void *malloc(long);
void free(void *);
int b(int m) {
if (m || a)
return 1;
return 0.0f;
}
int d(int m, int p2) { return b(m) + m + (1 + p2 + p2); }
int i() {
long l[] = {2, 9, 7, 8, g, g, 9, 0, 2, g};
e = l[c] << 6;
}
void n() {
long o;
int *p = malloc(sizeof(int));
k = 1 % j;
for (; i() + f + h; o++)
if (p[d(j + 6, (int)k + 1992695866) + h + f + j + (int)k - 1 + o])
free(p);
}
void main() {}
```
Compiler Explorer: https://godbolt.org/z/9bs5x6oEc
Bisected to
https://github.com/gcc-mirror/gcc/commit/5d88932657de239a941ad84ef0996a906ecd8fe9
Crash:
```
during GIMPLE pass: ivopts
<source>: In function 'n':
<source>:15:6: internal compiler error: in type, at value-range.h:984
15 | void n() {
| ^
0x25099e5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x252b176 internal_error(char const*, ...)
???:0
0x9f8608 fancy_abort(char const*, int, char const*)
???:0
0x23b832d split_constant_offset(tree_node*, tree_node**, tree_node**)
???:0
0x133e7f3 tree_ssa_iv_optimize()
???:0
```