https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113520
Bug ID: 113520
Summary: ICE when building swi-prolog-9.1.2 with LTO (tree
check: expected array_type, have integer_type in
array_ref_low_bound)
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
CC: arsen at gcc dot gnu.org
Target Milestone: ---
Arsen mentioned this to me earlier so I looked at reducing it.
ICEs when building swi-prolog-9.1.2 with LTO.
passing.c.i:
```
typedef void Any;
int get_table, getGetMethodClass_class;
extern int builtin_names[];
Any getResolveGetMethodClass();
static Any getGetMethodClass(int *name) {
getResolveGetMethodClass(get_table);
getResolveGetMethodClass(getGetMethodClass_class, name);
}
void pceResolveImplementation() { getGetMethodClass(&builtin_names[1]); }
```
name.c.i
```
int builtin_names;
```
```
$ gcc -flto -O3 passing.c.i name.c.i -shared
during GIMPLE pass: alias
passing.c.i: In function ‘pceResolveImplementation’:
passing.c.i:9:6: internal compiler error: tree check: expected array_type, have
integer_type in array_ref_low_bound, at tree.cc:12851
9 | void pceResolveImplementation() { getGetMethodClass(&builtin_names[1]);
}
| ^
0x5653e7eb8b8c tree_check_failed(tree_node const*, char const*, int, char
const*, ...)
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree.cc:8952
0x5653e71ee414 tree_check(tree_node*, char const*, int, char const*, tree_code)
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree.h:3612
0x5653e71ee414 array_ref_low_bound(tree_node*)
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree.cc:12851
0x5653e88640b8 get_ref_base_and_extent(tree_node*, poly_int<1u, long>*,
poly_int<1u, long>*, poly_int<1u, long>*, bool*)
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-dfa.cc:497
0x5653e8973a07 get_constraint_for_component_ref
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:3319
0x5653e8973a07 get_constraint_for_1(tree_node*, vec<constraint_expr, va_heap,
vl_ptr>*, bool, bool) [clone .isra.0]
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:3634
0x5653e89738aa get_constraint_for_address_of
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:3502
0x5653e89738aa get_constraint_for_1(tree_node*, vec<constraint_expr, va_heap,
vl_ptr>*, bool, bool) [clone .isra.0]
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:3570
0x5653e89ca9d7 get_constraint_for_rhs
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:3719
0x5653e89ca9d7 make_constraint_to
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:3848
0x5653e89ca9d7 handle_call_arg
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:4100
0x5653e89a7bcc handle_rhs_call
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:4344
0x5653e8971603 find_func_aliases_for_call
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:5018
0x5653e8971603 find_func_aliases
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:5121
0x5653e896b1d7 compute_points_to_sets
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:7573
0x5653e896b1d7 compute_may_aliases()
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/tree-ssa-structalias.cc:8027
0x5653e8722af3 execute_function_todo
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/passes.cc:2063
0x5653e8722af3 do_per_function
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/passes.cc:1687
0x5653e8722af3 execute_todo
/usr/src/debug/sys-devel/gcc-14.0.1.9999/gcc-14.0.1.9999/gcc/passes.cc:2142
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
```