[Bug target/88134] ICE in create_component_ref_by_pieces_1, at tree-ssa-pre.c:2520
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Fri Dec 21 12:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88134
--- Comment #22 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 21 Dec 2018, asolokha at gmx dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88134
>
> --- Comment #21 from Arseny Solokha <asolokha at gmx dot com> ---
> (In reply to Arseny Solokha from comment #13)
> > In decl_address_invariant_p() we hit this break:
> >
> > 3423 case VAR_DECL:
> > 3424 if ((TREE_STATIC (op) || DECL_EXTERNAL (op))
> > 3425 || DECL_THREAD_LOCAL_P (op)
> > 3426 || DECL_CONTEXT (op) == current_function_decl
> > 3427 || decl_function_context (op) == current_function_decl)
> > 3428 return true;
> > 3429 break;
> >
> > and return false, which in the end becomes what is_gimple_min_invariant()
> > returns.
>
> Indeed, w/ -ftrapping-math we have this at the point of the (failing)
> assertion:
>
> (gdb) p debug_tree (currop->op0)
> <addr_expr 0x7ffff78a0f60
> type <pointer_type 0x7ffff77cf888
> type <real_type 0x7ffff77cf498 double DF
> size <integer_cst 0x7ffff77c8000 constant 64>
> unit-size <integer_cst 0x7ffff77c8018 constant 8>
> align:64 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
> 0x7ffff77cf498 precision:64
> pointer_to_this <pointer_type 0x7ffff77cf888>>
> public unsigned SI
> size <integer_cst 0x7ffff77b6f90 constant 32>
> unit-size <integer_cst 0x7ffff77b6fa8 constant 4>
> align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7ffff77cf888>
>
> arg:0 <var_decl 0x7ffff7fcf5a0 D.1473 type <real_type 0x7ffff77cf498
> double>
> addressable used ignored read DF gcpt737x.c:9:5 size <integer_cst
> 0x7ffff77c8000 64> unit-size <integer_cst 0x7ffff77c8018 8>
> align:64 warn_if_not_align:0 context <function_decl 0x7ffff78a5c00
> i6>>>
> $1 = void
>
> while w/ -fno-trapping-math:
>
> (gdb) p debug_tree (currop->op0)
> <addr_expr 0x7ffff78cf0c0
> type <pointer_type 0x7ffff77cf888
> type <real_type 0x7ffff77cf498 double DF
> size <integer_cst 0x7ffff77c8000 constant 64>
> unit-size <integer_cst 0x7ffff77c8018 constant 8>
> align:64 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
> 0x7ffff77cf498 precision:64
> pointer_to_this <pointer_type 0x7ffff77cf888>>
> public unsigned SI
> size <integer_cst 0x7ffff77b6f90 constant 32>
> unit-size <integer_cst 0x7ffff77b6fa8 constant 4>
> align:32 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
> 0x7ffff77cf888>
>
> arg:0 <var_decl 0x7ffff7fcf6c0 D.1480 type <real_type 0x7ffff77cf498
> double>
> addressable used ignored DF gcpt737x.c:9:5 size <integer_cst
> 0x7ffff77c8000 64> unit-size <integer_cst 0x7ffff77c8018 8>
> align:64 warn_if_not_align:0>>
> $1 = void
>
> There's no function context in the latter case, so
>
> 3427 || decl_function_context (op) == current_function_decl)
>
> evaluates to false, and gcc_assert() eventually fails.
>
> In case of -fno-trapping-math this context gets assigned during the second call
> to gimple_add_tmp_var():
>
> 751 DECL_CONTEXT (tmp) = current_function_decl;
> 752 DECL_SEEN_IN_BIND_EXPR_P (tmp) = 1;
>
> and I fail to see why this doesn't happen w/ -ftrapping-math. The assignment
> clearly happens on the second invocation of gimple_add_tmp_var() but watchpoint
> doesn't fire.
>
> -fno-trapping-math:
>
> Breakpoint 1, gimple_add_tmp_var (tmp=0x7ffff7fcf510)
> at gcc/tree.h:3270
> (gdb)
> Continuing.
>
> Hardware watchpoint 3: -location DECL_CONTEXT (tmp)
>
> Old value = (tree_node *) 0x0
> New value = (tree_node *) 0x7ffff78a5c00
> gimple_add_tmp_var (tmp=0x7ffff7fcf510)
> at gcc/gimplify.c:752
>
> (gdb)
> Continuing.
>
> Breakpoint 1, gimple_add_tmp_var (tmp=0x7ffff7fcf5a0)
> at gcc/tree.h:3270
>
> (gdb)
> Continuing.
>
> Hardware watchpoint 4: -location TREE_OPERAND (currop->op0,
> 0).decl_minimal.context
>
> Old value = (tree_node *) 0x0
> New value = (tree_node *) 0x7ffff78a5c00
> gimple_add_tmp_var (tmp=0x7ffff7fcf5a0)
> at gcc/gimplify.c:752
>
> (gdb)
> Continuing.
>
> Breakpoint 1, gimple_add_tmp_var (tmp=0x7ffff7fcf630)
> at gcc/tree.h:3270
>
> (gdb)
> Continuing.
>
> Breakpoint 2, create_component_ref_by_pieces_1 (block=0x7ffff78a3888,
> ref=0x1e4d090, operand=0x7fffffffc7d0, stmts=0x7fffffffc868)
> at gcc/tree-ssa-pre.c:2520
>
> (gdb)
> Continuing.
> [Inferior 1 (process 4261) exited normally]
>
> -ftrapping-math:
>
> Breakpoint 1, gimple_add_tmp_var (tmp=0x7ffff7fcf510)
> at gcc/tree.h:3270
>
> (gdb)
> Continuing.
>
> Hardware watchpoint 3: -location DECL_CONTEXT (tmp)
>
> Old value = (tree_node *) 0x0
> New value = (tree_node *) 0x7ffff78a5c00
> gimple_add_tmp_var (tmp=0x7ffff7fcf510)
> at gcc/gimplify.c:752
>
> (gdb)
> Continuing.
>
> Breakpoint 1, gimple_add_tmp_var (tmp=0x7ffff7fcf5a0)
> at gcc/tree.h:3270
>
> (gdb)
> Continuing.
>
> Breakpoint 1, gimple_add_tmp_var (tmp=0x7ffff7fcf630)
> at gcc/tree.h:3270
>
> (gdb)
> Continuing.
>
> Breakpoint 2, create_component_ref_by_pieces_1 (block=0x7ffff78a3138,
> ref=0x1e4cb40, operand=0x7fffffffc960, stmts=0x7fffffffc9f8)
> at gcc/tree-ssa-pre.c:2520
>
> (gdb)
> Continuing.
> during GIMPLE pass: pre
> cptctz2r.c: In function 'i6':
> cptctz2r.c:4:1: internal compiler error: in create_component_ref_by_pieces_1,
> at tree-ssa-pre.c:2520
>
> What should I look at next?
Where do the vars get created from? (backtrace from the
gimple_add_tmp_var places?)
More information about the Gcc-bugs
mailing list