https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101036
Bug ID: 101036
Summary: ICE: in fold_convert_loc, at fold-const.c:2430
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: cnsun at uwaterloo dot ca
Target Milestone: ---
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.GWysxNSsSH-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210610 (experimental) [master revision
:697cc07ce:edec2660ff4890ecf8cc191f7c92cf527de51fe2] (GCC)
$ cat mutant.c
z1_called;
z1() { z1_called++; }
int z1_called[] = z3;
$ gcc-trunk mutant.c
mutant.c:1:1: warning: data definition has no type or storage class
1 | z1_called;
| ^~~~~~~~~
mutant.c:1:1: warning: type defaults to ‘int’ in declaration of ‘z1_called’
[-Wimplicit-int]
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | z1() { z1_called++; }
| ^~
mutant.c:3:5: error: conflicting types for ‘z1_called’; have ‘int[]’
3 | int z1_called[] = z3;
| ^~~~~~~~~
mutant.c:1:1: note: previous declaration of ‘z1_called’ with type ‘int’
1 | z1_called;
| ^~~~~~~~~
mutant.c:3:19: error: ‘z3’ undeclared here (not in a function); did you mean
‘z1’?
3 | int z1_called[] = z3;
| ^~
| z1
mutant.c: In function ‘z1’:
mutant.c:2:17: internal compiler error: in fold_convert_loc, at
fold-const.c:2430
2 | z1() { z1_called++; }
| ~~~~~~~~~^~
0x6c27da fold_convert_loc(unsigned int, tree_node*, tree_node*)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/fold-const.c:2430
0xc3a3fe gimplify_self_mod_expr(tree_node**, gimple**, gimple**, bool,
tree_node*)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:3202
0xc33e0f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:14009
0xc37aea gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:6863
0xc3831e gimplify_bind_expr
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:1424
0xc34553 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:14280
0xc37aea gimplify_stmt(tree_node**, gimple**)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:6863
0xc390e3 gimplify_body(tree_node*, bool)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:15324
0xc39531 gimplify_function_tree(tree_node*)
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/gimplify.c:15478
0xa8b027 cgraph_node::analyze()
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/cgraphunit.c:670
0xa8df51 analyze_functions
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/cgraphunit.c:1234
0xa8ea21 symbol_table::finalize_compilation_unit()
/tmp/tmp.GWysxNSsSH-gcc-builder/gcc/gcc/cgraphunit.c:2508
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.