https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68870
Bug ID: 68870
Summary: ICE on valid code at -O1, -O2 and -O3 on
x86_64-linux-gnu
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The following code causes an ICE when compiled with the current gcc trunk at
-O1, -O2 and -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes.
It is a regression from 5.3.x.
It looks identical to PR 68570, which has been fixed.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20151211 (experimental) [trunk revision 231553] (GCC)
$
$ gcc-trunk -O0 -c small.c
$ gcc-5.3 -O1 -c small.c
$
$ gcc-trunk -O1 -c small.c
small.c: In function ‘fn1’:
small.c:9:1: internal compiler error: Segmentation fault
fn1 ()
^~~
0xaf8b2f crash_signal
../../gcc-trunk/gcc/toplev.c:334
0xe56a14 gimple_truth_valued_p(tree_node*, tree_node* (*)(tree_node*))
/tmp/objdir/gcc/gimple-match.c:162
0xec4c49 gimple_simplify_NE_EXPR
/tmp/objdir/gcc/gimple-match.c:47934
0xe5c559 gimple_simplify
/tmp/objdir/gcc/gimple-match.c:52197
0xe5ef1d gimple_resimplify2(gimple**, code_helper*, tree_node*, tree_node**,
tree_node* (*)(tree_node*))
../../gcc-trunk/gcc/gimple-match-head.c:159
0xecb538 gimple_simplify(gimple*, code_helper*, tree_node**, gimple**,
tree_node* (*)(tree_node*), tree_node* (*)(tree_node*))
../../gcc-trunk/gcc/gimple-match-head.c:748
0xb3f90f cleanup_control_expr_graph
../../gcc-trunk/gcc/tree-cfgcleanup.c:101
0xb3f90f cleanup_control_flow_bb
../../gcc-trunk/gcc/tree-cfgcleanup.c:200
0xb40ecd cleanup_tree_cfg_1
../../gcc-trunk/gcc/tree-cfgcleanup.c:673
0xb40ecd cleanup_tree_cfg_noloop
../../gcc-trunk/gcc/tree-cfgcleanup.c:737
0xb40ecd cleanup_tree_cfg()
../../gcc-trunk/gcc/tree-cfgcleanup.c:788
0xa2cba4 execute_function_todo
../../gcc-trunk/gcc/passes.c:1911
0xa2d5fb execute_todo
../../gcc-trunk/gcc/passes.c:2010
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$
--------------------------------------------
int printf (const char *, ...);
int a, f, g;
char b, d;
short c;
static short e;
char
fn1 ()
{
for (; b; b++)
{
int h = 5;
for (a = 0; a < 1; a++)
{
for (d = 0; d < 1; d++)
for (c = 0; c < 1; c++)
for (; e >= 0;)
return 5;
if (f)
h = 0;
}
if (h)
printf ("%d", 0);
}
return g;
}