[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #16 from Yvan Roux yroux at gcc dot gnu.org --- Author: yroux Date: Mon Mar 23 09:50:33 2015 New Revision: 221589 URL: https://gcc.gnu.org/viewcvs?rev=221589root=gccview=rev Log: gcc/ 2015-03-23 Yvan Roux yvan.r...@linaro.org Backport from trunk r216841. 2014-10-29 Martin Liska mli...@suse.cz PR ipa/63587 * cgraphunit.c (cgraph_node::expand_thunk): Only VAR_DECLs are put to local declarations. * function.c (add_local_decl): Implementation moved from header file, assert introduced for tree type. * function.h: Likewise. gcc/testsuite/ 2015-03-23 Yvan Roux yvan.r...@linaro.org Backport from trunk r216841. 2014-10-29 Martin Liska mli...@suse.cz PR ipa/63587 * g++.dg/ipa/pr63587-1.C: New test. * g++.dg/ipa/pr63587-2.C: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/pr63587-1.C branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/pr63587-2.C Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/cgraphunit.c branches/gcc-4_9-branch/gcc/function.c branches/gcc-4_9-branch/gcc/function.h branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #14 from Martin Liška marxin at gcc dot gnu.org --- Author: marxin Date: Wed Oct 29 15:17:42 2014 New Revision: 216841 URL: https://gcc.gnu.org/viewcvs?rev=216841root=gccview=rev Log: PR ipa/63587 * g++.dg/ipa/pr63587-1.C: New test * g++.dg/ipa/pr63587-2.C: New test. * cgraphunit.c (cgraph_node::expand_thunk): Only VAR_DECLs are put to local declarations. * function.c (add_local_decl): Implementation moved from header file, assert introduced for tree type. * function.h: Likewise. Added: trunk/gcc/testsuite/g++.dg/ipa/pr63587-1.C trunk/gcc/testsuite/g++.dg/ipa/pr63587-2.C Modified: trunk/gcc/ChangeLog trunk/gcc/cgraphunit.c trunk/gcc/function.c trunk/gcc/function.h trunk/gcc/testsuite/ChangeLog
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 Martin Liška marxin at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #15 from Martin Liška marxin at gcc dot gnu.org --- Resolved.
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #10 from rguenther at suse dot de rguenther at suse dot de --- On Thu, 23 Oct 2014, marxin at gcc dot gnu.org wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #8 from Martin Liška marxin at gcc dot gnu.org --- I added assert to cgraphunit.c (expand_thunk):1547: /* Build call to the function being thunked. */ if (!VOID_TYPE_P (restype)) { if (DECL_BY_REFERENCE (resdecl)) restmp = gimple_fold_indirect_ref (resdecl); else if (!is_gimple_reg_type (restype)) { restmp = resdecl; gcc_assert (TREE_CODE (restmp) == VAR_DECL); add_local_decl (cfun, restmp); BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; } else restmp = create_tmp_reg (restype, retval); } It's triggered quite often, one example of a thunk created by IPA ICF: Well, the bug is the add_local_decl being called with a RESULT_DECL. Thus you should try placing an assert into add_local_decl instead (need to move it out-of-line for that). std::basic_streambuf_CharT, _Traits::pos_type std::basic_streambuf_CharT, _Traits::seekpos(std::basic_streambuf_CharT, _Traits::pos_type, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traitschar; std::basic_streambuf_CharT, _Traits::pos_type = std::fpos__mbstate_t; std::ios_base::openmode = std::_Ios_Openmode] (struct basic_streambuf * const this, struct pos_type D.23077, openmode D.23078) { struct pos_type retval; bb 2: retval = std::basic_streambufwchar_t::seekpos (this_2(D), D.23077, _3(D)); [tail call] return retval; } where std::basic_streambuf_CharT, _Traits::pos_type is: result_decl 0x74eec708 D.39821 type record_type 0x759c2150 pos_type sizes-gimplified asm_written used needs-constructing type_1 type_5 TI size integer_cst 0x76c2fe40 constant 128 unit size integer_cst 0x76c2fe58 constant 16 align 64 symtab -164402368 alias set -1 canonical type 0x7614adc8 fields field_decl 0x751cd850 _M_off type integer_type 0x7678c738 streamoff used private nonlocal decl_3 DI file /home/marxin/Programming/gcc/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/postypes.h line 115 col 33 size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 offset_align 128 offset integer_cst 0x76c2fe28 constant 0 bit offset integer_cst 0x76c2fe70 constant 0 context record_type 0x7614adc8 fpos chain field_decl 0x751cd8e8 _M_state context namespace_decl 0x76c4c098 std full-name std::basic_streambufchar::pos_type needs-constructor X() has-type-conversion X(constX) this=(X) n_parents=0 use_template=1 interface-unknown pointer_to_this pointer_type 0x75224e70 chain type_decl 0x76146da8 fpos ignored TI file /home/marxin/Programming/gcc/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/streambuf line 602 col 7 size integer_cst 0x76c2fe40 128 unit size integer_cst 0x76c2fe58 16 align 64 context function_decl 0x75797948 seekoff Is there a bug in expand_thunk or do I miss something? Thanks, Martin
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 Martin Liška marxin at gcc dot gnu.org changed: What|Removed |Added CC||doko at gcc dot gnu.org --- Comment #11 from Martin Liška marxin at gcc dot gnu.org --- *** Bug 63573 has been marked as a duplicate of this bug. ***
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #12 from Martin Liška mliska at suse dot cz --- On 10/24/2014 10:44 AM, rguenther at suse dot de wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #10 from rguenther at suse dot de rguenther at suse dot de --- On Thu, 23 Oct 2014, marxin at gcc dot gnu.org wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #8 from Martin Liška marxin at gcc dot gnu.org --- I added assert to cgraphunit.c (expand_thunk):1547: /* Build call to the function being thunked. */ if (!VOID_TYPE_P (restype)) { if (DECL_BY_REFERENCE (resdecl)) restmp = gimple_fold_indirect_ref (resdecl); else if (!is_gimple_reg_type (restype)) { restmp = resdecl; gcc_assert (TREE_CODE (restmp) == VAR_DECL); add_local_decl (cfun, restmp); BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; } else restmp = create_tmp_reg (restype, retval); } It's triggered quite often, one example of a thunk created by IPA ICF: Well, the bug is the add_local_decl being called with a RESULT_DECL. Thus you should try placing an assert into add_local_decl instead (need to move it out-of-line for that). You are right, it would be good to place assert to add_local_decl function, attachment contains suggested patch that I will regtest. Problematic is that one would like to place assert to function.h, but gengtype does not include tree.h for gencondmd.c: In file included from build/gencondmd.c:5:0: ../../gcc/function.h: In function ‘void add_local_decl(function*, tree)’: ../../gcc/function.h:674:27: error: ‘TREE_CODE’ was not declared in this scope gcc_assert (TREE_CODE (d) == VAR_DECL); Is it acceptable to put the implementation to function.c? Thanks, Martin std::basic_streambuf_CharT, _Traits::pos_type std::basic_streambuf_CharT, _Traits::seekpos(std::basic_streambuf_CharT, _Traits::pos_type, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traitschar; std::basic_streambuf_CharT, _Traits::pos_type = std::fpos__mbstate_t; std::ios_base::openmode = std::_Ios_Openmode] (struct basic_streambuf * const this, struct pos_type D.23077, openmode D.23078) { struct pos_type retval; bb 2: retval = std::basic_streambufwchar_t::seekpos (this_2(D), D.23077, _3(D)); [tail call] return retval; } where std::basic_streambuf_CharT, _Traits::pos_type is: result_decl 0x74eec708 D.39821 type record_type 0x759c2150 pos_type sizes-gimplified asm_written used needs-constructing type_1 type_5 TI size integer_cst 0x76c2fe40 constant 128 unit size integer_cst 0x76c2fe58 constant 16 align 64 symtab -164402368 alias set -1 canonical type 0x7614adc8 fields field_decl 0x751cd850 _M_off type integer_type 0x7678c738 streamoff used private nonlocal decl_3 DI file /home/marxin/Programming/gcc/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/postypes.h line 115 col 33 size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 offset_align 128 offset integer_cst 0x76c2fe28 constant 0 bit offset integer_cst 0x76c2fe70 constant 0 context record_type 0x7614adc8 fpos chain field_decl 0x751cd8e8 _M_state context namespace_decl 0x76c4c098 std full-name std::basic_streambufchar::pos_type needs-constructor X() has-type-conversion X(constX) this=(X) n_parents=0 use_template=1 interface-unknown pointer_to_this pointer_type 0x75224e70 chain type_decl 0x76146da8 fpos ignored TI file /home/marxin/Programming/gcc/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/streambuf line 602 col 7 size integer_cst 0x76c2fe40 128 unit size integer_cst 0x76c2fe58 16 align 64 context function_decl 0x75797948 seekoff Is there a bug in expand_thunk or do I miss something? Thanks, Martin
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #13 from rguenther at suse dot de rguenther at suse dot de --- On Fri, 24 Oct 2014, mliska at suse dot cz wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #12 from Martin Liška mliska at suse dot cz --- On 10/24/2014 10:44 AM, rguenther at suse dot de wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #10 from rguenther at suse dot de rguenther at suse dot de --- On Thu, 23 Oct 2014, marxin at gcc dot gnu.org wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #8 from Martin Liška marxin at gcc dot gnu.org --- I added assert to cgraphunit.c (expand_thunk):1547: /* Build call to the function being thunked. */ if (!VOID_TYPE_P (restype)) { if (DECL_BY_REFERENCE (resdecl)) restmp = gimple_fold_indirect_ref (resdecl); else if (!is_gimple_reg_type (restype)) { restmp = resdecl; gcc_assert (TREE_CODE (restmp) == VAR_DECL); add_local_decl (cfun, restmp); BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; } else restmp = create_tmp_reg (restype, retval); } It's triggered quite often, one example of a thunk created by IPA ICF: Well, the bug is the add_local_decl being called with a RESULT_DECL. Thus you should try placing an assert into add_local_decl instead (need to move it out-of-line for that). You are right, it would be good to place assert to add_local_decl function, attachment contains suggested patch that I will regtest. Problematic is that one would like to place assert to function.h, but gengtype does not include tree.h for gencondmd.c: In file included from build/gencondmd.c:5:0: ../../gcc/function.h: In function ‘void add_local_decl(function*, tree)’: ../../gcc/function.h:674:27: error: ‘TREE_CODE’ was not declared in this scope gcc_assert (TREE_CODE (d) == VAR_DECL); Is it acceptable to put the implementation to function.c? Yes. Richard.
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #5 from marxin at gcc dot gnu.org --- (In reply to rguent...@suse.de from comment #4) On Sun, 19 Oct 2014, mliska at suse dot cz wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #2 from Martin Liška mliska at suse dot cz --- Following two functions are merged: static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actorint, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actor{anonymous}::my_class, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) with following body: { struct type D.3826; struct to_log_fun D.3825; struct attribute_name D.3824; int SR.9; struct actor left; bb 2: left = left; SR.9_4 = MEM[(struct attribute_terminal *)right_2(D)]; MEM[(struct attribute_name *)D.3824] = SR.9_4; boost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun::attribute_output_terminalint (D.3826, left, D.3824, D.3825, 0); D.3826 ={v} {CLOBBER}; return; } As I was debugging ao_ref_alias_sets, there's MEM_REF where we have different template arguments: attribute_actorint,... vs. attribute_actor{anonymous}::my_class, What do you think Richard about these record_types from alias set perspective: (gdb) p debug_tree(t1) mem_ref 0x76ab4000 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76aae678 type reference_type 0x76e20d20 type record_type 0x76de7dc8 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20d20 visited var parm_decl 0x76e1eb00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e3d8 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 $1 = void (gdb) p debug_tree(t2) mem_ref 0x76aa1ac8 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76a77dc8 type reference_type 0x76e20540 type record_type 0x76ddd888 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20540 visited var parm_decl 0x76e1ea00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e300 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 these types are called for alias_set comparison, with following record_types: (gdb) p debug_tree((tree_node*)0x76de7dc8) record_type 0x76de7dc8 attribute_actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 type integer_type 0x76c33150 bitsizetype constant 32 unit size integer_cst 0x76c51060 type integer_type 0x76c330a8 sizetype constant 4 align 32 symtab 0 alias set 17 canonical type 0x76de7dc8 fields field_decl 0x76de4ed8 D.2798 type record_type 0x76dddb28 actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 32 unit size integer_cst 0x76c51060
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #6 from marxin at gcc dot gnu.org --- Created attachment 33794 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33794action=edit PR63587.patch
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #7 from rguenther at suse dot de rguenther at suse dot de --- On Thu, 23 Oct 2014, marxin at gcc dot gnu.org wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #5 from marxin at gcc dot gnu.org --- (In reply to rguent...@suse.de from comment #4) On Sun, 19 Oct 2014, mliska at suse dot cz wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #2 from Martin Liška mliska at suse dot cz --- Following two functions are merged: static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actorint, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actor{anonymous}::my_class, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) with following body: { struct type D.3826; struct to_log_fun D.3825; struct attribute_name D.3824; int SR.9; struct actor left; bb 2: left = left; SR.9_4 = MEM[(struct attribute_terminal *)right_2(D)]; MEM[(struct attribute_name *)D.3824] = SR.9_4; boost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun::attribute_output_terminalint (D.3826, left, D.3824, D.3825, 0); D.3826 ={v} {CLOBBER}; return; } As I was debugging ao_ref_alias_sets, there's MEM_REF where we have different template arguments: attribute_actorint,... vs. attribute_actor{anonymous}::my_class, What do you think Richard about these record_types from alias set perspective: (gdb) p debug_tree(t1) mem_ref 0x76ab4000 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76aae678 type reference_type 0x76e20d20 type record_type 0x76de7dc8 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20d20 visited var parm_decl 0x76e1eb00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e3d8 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 $1 = void (gdb) p debug_tree(t2) mem_ref 0x76aa1ac8 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76a77dc8 type reference_type 0x76e20540 type record_type 0x76ddd888 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20540 visited var parm_decl 0x76e1ea00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e300 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 these types are called for alias_set comparison, with following record_types: (gdb) p debug_tree((tree_node*)0x76de7dc8) record_type 0x76de7dc8 attribute_actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 type integer_type 0x76c33150 bitsizetype constant 32 unit size integer_cst 0x76c51060 type
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #8 from Martin Liška marxin at gcc dot gnu.org --- I added assert to cgraphunit.c (expand_thunk):1547: /* Build call to the function being thunked. */ if (!VOID_TYPE_P (restype)) { if (DECL_BY_REFERENCE (resdecl)) restmp = gimple_fold_indirect_ref (resdecl); else if (!is_gimple_reg_type (restype)) { restmp = resdecl; gcc_assert (TREE_CODE (restmp) == VAR_DECL); add_local_decl (cfun, restmp); BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; } else restmp = create_tmp_reg (restype, retval); } It's triggered quite often, one example of a thunk created by IPA ICF: std::basic_streambuf_CharT, _Traits::pos_type std::basic_streambuf_CharT, _Traits::seekpos(std::basic_streambuf_CharT, _Traits::pos_type, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traitschar; std::basic_streambuf_CharT, _Traits::pos_type = std::fpos__mbstate_t; std::ios_base::openmode = std::_Ios_Openmode] (struct basic_streambuf * const this, struct pos_type D.23077, openmode D.23078) { struct pos_type retval; bb 2: retval = std::basic_streambufwchar_t::seekpos (this_2(D), D.23077, _3(D)); [tail call] return retval; } where std::basic_streambuf_CharT, _Traits::pos_type is: result_decl 0x74eec708 D.39821 type record_type 0x759c2150 pos_type sizes-gimplified asm_written used needs-constructing type_1 type_5 TI size integer_cst 0x76c2fe40 constant 128 unit size integer_cst 0x76c2fe58 constant 16 align 64 symtab -164402368 alias set -1 canonical type 0x7614adc8 fields field_decl 0x751cd850 _M_off type integer_type 0x7678c738 streamoff used private nonlocal decl_3 DI file /home/marxin/Programming/gcc/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/postypes.h line 115 col 33 size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 offset_align 128 offset integer_cst 0x76c2fe28 constant 0 bit offset integer_cst 0x76c2fe70 constant 0 context record_type 0x7614adc8 fpos chain field_decl 0x751cd8e8 _M_state context namespace_decl 0x76c4c098 std full-name std::basic_streambufchar::pos_type needs-constructor X() has-type-conversion X(constX) this=(X) n_parents=0 use_template=1 interface-unknown pointer_to_this pointer_type 0x75224e70 chain type_decl 0x76146da8 fpos ignored TI file /home/marxin/Programming/gcc/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/streambuf line 602 col 7 size integer_cst 0x76c2fe40 128 unit size integer_cst 0x76c2fe58 16 align 64 context function_decl 0x75797948 seekoff Is there a bug in expand_thunk or do I miss something? Thanks, Martin
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #9 from Martin Liška mliska at suse dot cz --- On 10/20/2014 09:48 AM, rguenther at suse dot de wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #4 from rguenther at suse dot de rguenther at suse dot de --- On Sun, 19 Oct 2014, mliska at suse dot cz wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #2 from Martin Liška mliska at suse dot cz --- Following two functions are merged: static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actorint, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actor{anonymous}::my_class, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) with following body: { struct type D.3826; struct to_log_fun D.3825; struct attribute_name D.3824; int SR.9; struct actor left; bb 2: left = left; SR.9_4 = MEM[(struct attribute_terminal *)right_2(D)]; MEM[(struct attribute_name *)D.3824] = SR.9_4; boost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun::attribute_output_terminalint (D.3826, left, D.3824, D.3825, 0); D.3826 ={v} {CLOBBER}; return; } As I was debugging ao_ref_alias_sets, there's MEM_REF where we have different template arguments: attribute_actorint,... vs. attribute_actor{anonymous}::my_class, What do you think Richard about these record_types from alias set perspective: (gdb) p debug_tree(t1) mem_ref 0x76ab4000 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76aae678 type reference_type 0x76e20d20 type record_type 0x76de7dc8 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20d20 visited var parm_decl 0x76e1eb00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e3d8 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 $1 = void (gdb) p debug_tree(t2) mem_ref 0x76aa1ac8 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76a77dc8 type reference_type 0x76e20540 type record_type 0x76ddd888 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20540 visited var parm_decl 0x76e1ea00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e300 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 these types are called for alias_set comparison, with following record_types: (gdb) p debug_tree((tree_node*)0x76de7dc8) record_type 0x76de7dc8 attribute_actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 type integer_type 0x76c33150 bitsizetype constant 32 unit size integer_cst 0x76c51060 type integer_type 0x76c330a8 sizetype constant 4 align 32 symtab 0 alias set 17 canonical type 0x76de7dc8 fields field_decl 0x76de4ed8 D.2798 type record_type 0x76dddb28 actor needs-constructing type_5 type_6 SI size integer_cst
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #3 from Markus Trippelsdorf trippels at gcc dot gnu.org --- Here's another smaller example: % cat test.ii template class struct A { }; template typename struct B { template typename struct C; }; class D; template typename class F; struct G { void operator()(const D , D); }; class D { public: D (int); }; struct H { H (int); }; template typename _Key, typename, typename, typename _Compare, typename class I { typedef _Key key_type; template typename _Key_compare struct J { _Key_compare _M_key_compare; }; J_Compare _M_impl; public: Aint _M_get_insert_unique_pos (const key_type ); Aint _M_get_insert_hint_unique_pos (H ); template typename... _Args int _M_emplace_hint_unique (H, _Args ...); }; template typename _Key, typename _Tp, typename _Compare = G, typename _Alloc = FA_Tp class K { typedef _Key key_type; typedef _Key value_type; typedef typename B_Alloc::template Cvalue_type _Pair_alloc_type; Ikey_type, value_type, int, _Compare, _Pair_alloc_type _M_t; public: void operator[](key_type) { _M_t._M_emplace_hint_unique (0); } }; template typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc Aint I_Key, _Val, _KeyOfValue, _Compare, _Alloc::_M_get_insert_unique_pos ( const key_type p1) { _M_impl._M_key_compare (p1, 0); } template typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc Aint I_Key, _Val, _KeyOfValue, _Compare, _Alloc::_M_get_insert_hint_unique_pos ( H ) { _M_get_insert_unique_pos (0); } template typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc template typename... _Args int I_Key, _Val, _KeyOfValue, _Compare, _Alloc::_M_emplace_hint_unique ( H p1, _Args ...) { _M_get_insert_hint_unique_pos (p1); } namespace { struct L; } void fn1 () { KD, L a; a[0]; KD, int b; b[0]; } % g++ -c -O2 -std=c++11 -fno-strict-aliasing test.ii test.ii: In function ‘void fn1()’: test.ii:64:28: internal compiler error: tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #4 from rguenther at suse dot de rguenther at suse dot de --- On Sun, 19 Oct 2014, mliska at suse dot cz wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #2 from Martin Liška mliska at suse dot cz --- Following two functions are merged: static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actorint, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actor{anonymous}::my_class, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) with following body: { struct type D.3826; struct to_log_fun D.3825; struct attribute_name D.3824; int SR.9; struct actor left; bb 2: left = left; SR.9_4 = MEM[(struct attribute_terminal *)right_2(D)]; MEM[(struct attribute_name *)D.3824] = SR.9_4; boost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun::attribute_output_terminalint (D.3826, left, D.3824, D.3825, 0); D.3826 ={v} {CLOBBER}; return; } As I was debugging ao_ref_alias_sets, there's MEM_REF where we have different template arguments: attribute_actorint,... vs. attribute_actor{anonymous}::my_class, What do you think Richard about these record_types from alias set perspective: (gdb) p debug_tree(t1) mem_ref 0x76ab4000 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76aae678 type reference_type 0x76e20d20 type record_type 0x76de7dc8 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20d20 visited var parm_decl 0x76e1eb00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e3d8 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 $1 = void (gdb) p debug_tree(t2) mem_ref 0x76aa1ac8 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76a77dc8 type reference_type 0x76e20540 type record_type 0x76ddd888 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20540 visited var parm_decl 0x76e1ea00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e300 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 these types are called for alias_set comparison, with following record_types: (gdb) p debug_tree((tree_node*)0x76de7dc8) record_type 0x76de7dc8 attribute_actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 type integer_type 0x76c33150 bitsizetype constant 32 unit size integer_cst 0x76c51060 type integer_type 0x76c330a8 sizetype constant 4 align 32 symtab 0 alias set 17 canonical type 0x76de7dc8 fields field_decl 0x76de4ed8 D.2798 type record_type 0x76dddb28 actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 32 unit size integer_cst 0x76c51060 4 align 32 symtab 0 alias set 15 canonical type 0x76dddb28 fields field_decl 0x76de01c8 proto_expr_ context namespace_decl 0x76d8d2f8 boost
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |5.0
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #2 from Martin Liška mliska at suse dot cz --- Following two functions are merged: static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actorint, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) static boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::make(ActorTLeftExprT, RightT) [with ActorT = boost::actor; LeftExprT = int; RightT = boost::log::attribute_actor{anonymous}::my_class, boost::log::value_extractor, void, boost::actor; ValueT = int; boost::log::make_output_actorActorTLeftExprT, RightT, ValueT::type = boost::actorboost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun ] (struct actor left, struct attribute_actor right) with following body: { struct type D.3826; struct to_log_fun D.3825; struct attribute_name D.3824; int SR.9; struct actor left; bb 2: left = left; SR.9_4 = MEM[(struct attribute_terminal *)right_2(D)]; MEM[(struct attribute_name *)D.3824] = SR.9_4; boost::log::attribute_output_terminalboost::actorint, boost::log::to_log_fun::attribute_output_terminalint (D.3826, left, D.3824, D.3825, 0); D.3826 ={v} {CLOBBER}; return; } As I was debugging ao_ref_alias_sets, there's MEM_REF where we have different template arguments: attribute_actorint,... vs. attribute_actor{anonymous}::my_class, What do you think Richard about these record_types from alias set perspective: (gdb) p debug_tree(t1) mem_ref 0x76ab4000 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76aae678 type reference_type 0x76e20d20 type record_type 0x76de7dc8 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20d20 visited var parm_decl 0x76e1eb00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e3d8 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 $1 = void (gdb) p debug_tree(t2) mem_ref 0x76aa1ac8 type integer_type 0x76c33690 int public type_6 SI size integer_cst 0x76c51048 constant 32 unit size integer_cst 0x76c51060 constant 4 align 32 symtab 0 alias set 4 canonical type 0x76c33690 precision 32 min integer_cst 0x76c51000 -2147483648 max integer_cst 0x76c51018 2147483647 pointer_to_this pointer_type 0x76c55738 arg 0 ssa_name 0x76a77dc8 type reference_type 0x76e20540 type record_type 0x76ddd888 attribute_actor unsigned DI size integer_cst 0x76c2fdf8 constant 64 unit size integer_cst 0x76c2fe10 constant 8 align 64 symtab 0 alias set 7 canonical type 0x76e20540 visited var parm_decl 0x76e1ea00 rightdef_stmt GIMPLE_NOP version 2 ptr-info 0x76a7e300 arg 1 integer_cst 0x76a4ee28 type pointer_type 0x76dbfa80 constant 0 these types are called for alias_set comparison, with following record_types: (gdb) p debug_tree((tree_node*)0x76de7dc8) record_type 0x76de7dc8 attribute_actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 type integer_type 0x76c33150 bitsizetype constant 32 unit size integer_cst 0x76c51060 type integer_type 0x76c330a8 sizetype constant 4 align 32 symtab 0 alias set 17 canonical type 0x76de7dc8 fields field_decl 0x76de4ed8 D.2798 type record_type 0x76dddb28 actor needs-constructing type_5 type_6 SI size integer_cst 0x76c51048 32 unit size integer_cst 0x76c51060 4 align 32 symtab 0 alias set 15 canonical type 0x76dddb28 fields field_decl 0x76de01c8 proto_expr_ context namespace_decl 0x76d8d2f8 boost full-name struct boost::actorboost::log::attribute_terminal needs-constructor X() X(constX) this=(X) n_parents=0 use_template=1 interface-unknown pointer_to_this pointer_type 0x76e03930 reference_to_this reference_type 0x76dff0a8 chain type_decl 0x76de0098
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63587 --- Comment #1 from Markus Trippelsdorf trippels at gcc dot gnu.org --- Created attachment 33754 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33754action=edit reduced testcase