This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
- From: "marxin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 23 Oct 2014 17:03:02 +0000
- Subject: [Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
- Auto-submitted: auto-generated
- References: <bug-63587-4 at http dot gcc dot gnu dot org/bugzilla/>
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_traits<char>;
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_streambuf<wchar_t>::seekpos (this_2(D), D.23077,
_3(D)); [tail call]
return <retval>;
}
where std::basic_streambuf<_CharT, _Traits>::pos_type is:
<result_decl 0x7ffff4eec708 D.39821
type <record_type 0x7ffff59c2150 pos_type sizes-gimplified asm_written used
needs-constructing type_1 type_5 TI
size <integer_cst 0x7ffff6c2fe40 constant 128>
unit size <integer_cst 0x7ffff6c2fe58 constant 16>
align 64 symtab -164402368 alias set -1 canonical type 0x7ffff614adc8
fields <field_decl 0x7ffff51cd850 _M_off type <integer_type
0x7ffff678c738 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 0x7ffff6c2fdf8 constant 64>
unit size <integer_cst 0x7ffff6c2fe10 constant 8>
align 64 offset_align 128
offset <integer_cst 0x7ffff6c2fe28 constant 0>
bit offset <integer_cst 0x7ffff6c2fe70 constant 0> context
<record_type 0x7ffff614adc8 fpos> chain <field_decl 0x7ffff51cd8e8 _M_state>>
context <namespace_decl 0x7ffff6c4c098 std>
full-name "std::basic_streambuf<char>::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 0x7ffff5224e70> chain <type_decl
0x7ffff6146da8 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 0x7ffff6c2fe40 128> unit size <integer_cst
0x7ffff6c2fe58 16>
align 64 context <function_decl 0x7ffff5797948 seekoff>>
Is there a bug in expand_thunk or do I miss something?
Thanks,
Martin