This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix PR41275, ICE in expand_expr_real_1


On Thu, Sep 10, 2009 at 5:13 PM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> the issue here is that the inliner put DECL_EXTERNAL decls on the
> local_decls list. ?This wasn't a problem in the past until free_lang_data
> was merged. ?The latter sets DECL_CONTEXT for all vars on the local_decls
> list to the containing function (a sensible thing one might think :) ),
> but those DECL_EXTERNAL things are shared amongst different functions
> hence a DECL_CONTEXT doesn't make sense (it's supposed to be NULL). ?That
> triggered the assert in expand_expr_real_1.
>
> The solution is to do the same thing as record_vars_into(), the canonical
> thing to fill the local_decls list. ?The inliner btw. does strange and
> wonderful things with these lists, no wonder it breaks from time to time
> :)
>
> Regstrapping on x86-64 in progress (all langs + Ada). ?Okay for trunk?

Ok.

Thanks,
Richard.

>
> Ciao,
> Michael.
> --
> ? ? ? ?PR middle-end/41275
> ? ? ? ?* tree-inline.c (remap_decls): Don't put DECL_EXTERNAL decls
> ? ? ? ?on the local_decls list.
>
> testsuite/
> ? ? ? ?* g++.dg/tree-ssa/pr41275.C: New test.
>
> Index: tree-inline.c
> ===================================================================
> --- tree-inline.c ? ? ? (revision 151593)
> +++ tree-inline.c ? ? ? (working copy)
> @@ -536,6 +536,7 @@ remap_decls (tree decls, VEC(tree,gc) **
> ? ? ? if (can_be_nonlocal (old_var, id))
> ? ? ? ?{
> ? ? ? ? ?if (TREE_CODE (old_var) == VAR_DECL
> + ? ? ? ? ? ? && ! DECL_EXTERNAL (old_var)
> ? ? ? ? ? ? ?&& (var_ann (old_var) || !gimple_in_ssa_p (cfun)))
> ? ? ? ? ? ?cfun->local_decls = tree_cons (NULL_TREE, old_var,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cfun->local_decls);
> Index: testsuite/g++.dg/tree-ssa/pr41275.C
> ===================================================================
> --- testsuite/g++.dg/tree-ssa/pr41275.C (revision 0)
> +++ testsuite/g++.dg/tree-ssa/pr41275.C (revision 0)
> @@ -0,0 +1,16 @@
> +// PR middle-end/41275
> +// { dg-do compile }
> +// { dg-options "-O2" }
> +// this used to ICE
> +struct ErrmsgWindow
> +{
> + ? ?virtual ~ErrmsgWindow()
> + ? ?{
> + ? ? ?extern int _switch_mode_errorstr;
> + ? ? ?_switch_mode_errorstr = 42;
> + ? ?}
> +};
> +void ShowErrorMessage(void)
> +{
> + ?ErrmsgWindow w;
> +}
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]