[Bug ipa/63587] [5 Regression] ICE : tree check: expected var_decl, have result_decl in add_local_variables, at tree-inline.c:4112
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Fri Oct 24 10:39:00 GMT 2014
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.
More information about the Gcc-bugs
mailing list