https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82765
Bug ID: 82765
Summary: ICE at -Os on valid code on x86_64-linux-gnu: in
tree_to_shwi, at tree.c:6611
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: helloqirun at gmail dot com
Target Milestone: ---
It happens at -Os and in 64-bit mode only.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 8.0.0 20171028 (experimental) [trunk revision 254197] (GCC)
$ gcc-trunk -Os abc.c
abc.c: In function ‘main’:
abc.c:2:26: warning: initialization of ‘int *’ from incompatible pointer type
‘int (*)[1]’ [-Wincompatible-pointer-types]
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
^
abc.c:2:26: note: (near initialization for ‘b[0]’)
abc.c:2:31: warning: integer constant is too large for its type
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
^~~~~~~~~~~~~~~~~~~~~~~~~
abc.c:2:59: warning: initialization of ‘int *’ from incompatible pointer type
‘int (*)[1]’ [-Wincompatible-pointer-types]
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
^
abc.c:2:59: note: (near initialization for ‘b[2]’)
abc.c:2:62: warning: initialization of ‘int *’ from incompatible pointer type
‘int (*)[1]’ [-Wincompatible-pointer-types]
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
^
abc.c:2:62: note: (near initialization for ‘b[3]’)
abc.c:2:65: warning: initialization of ‘int *’ from incompatible pointer type
‘int (*)[1]’ [-Wincompatible-pointer-types]
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
^
abc.c:2:65: note: (near initialization for ‘b[4]’)
abc.c:2:19: internal compiler error: in tree_to_shwi, at tree.c:6611
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }
^
0xec4467 tree_to_shwi(tree_node const*)
../../gcc/gcc/tree.c:6611
0xf1c62d decode_addr_const
../../gcc/gcc/varasm.c:2897
0xf1d807 const_hash_1
../../gcc/gcc/varasm.c:3038
0xf1d90e const_hash_1
../../gcc/gcc/varasm.c:3068
0xf1da1b const_hash_1
../../gcc/gcc/varasm.c:3028
0xf1dc42 tree_output_constant_def(tree_node*)
../../gcc/gcc/varasm.c:3545
0xa4d1ff gimplify_init_constructor
../../gcc/gcc/gimplify.c:4801
0xa4e134 gimplify_modify_expr_rhs
../../gcc/gcc/gimplify.c:5128
0xa4e779 gimplify_modify_expr
../../gcc/gcc/gimplify.c:5471
0xa412e9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11334
0xa44248 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6550
0xa48283 gimplify_and_add(tree_node*, gimple**)
../../gcc/gcc/gimplify.c:440
0xa48283 gimplify_decl_expr
../../gcc/gcc/gimplify.c:1681
0xa403f2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11530
0xa44248 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6550
0xa452ee gimplify_bind_expr
../../gcc/gcc/gimplify.c:1292
0xa411e2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11534
0xa44248 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.c:6550
0xa3fcc3 gimplify_statement_list
../../gcc/gcc/gimplify.c:1734
0xa3fcc3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:11762
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.
$ cat abc.c
int a[1][1];
int main() { int *b[] = {a, a[1820408606019012862278468], a, a, a}; }