This is the mail archive of the gcc-bugs@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]

[Bug ipa/69241] [6 Regression] ICE with noreturn and function that return non-POD


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69241

--- Comment #13 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #12)
> (In reply to Patrick Palka from comment #11)
> > More reduced test case, that does not depend on -ipa-icf:
> > 
> > struct R
> > {
> >   R (const R&) { }
> > };
> > 
> > __attribute__ ((noreturn)) R f ();
> > 
> > R
> > c ()
> > {
> >   f ();
> > }
> > 
> > Untested fix:
> > 
> > diff --git a/gcc/gimplify.c b/gcc/gimplify.c
> > index ce1e712..e07cd04 100644
> > --- a/gcc/gimplify.c
> > +++ b/gcc/gimplify.c
> > @@ -4830,7 +4830,8 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p,
> > gimple_seq *post_p,
> >             }
> >         }
> >        notice_special_calls (call_stmt);
> > -      if (!gimple_call_noreturn_p (call_stmt))
> > +      if (!gimple_call_noreturn_p (call_stmt)
> > +         || gimple_call_return_slot_opt_p (call_stmt))
> >         gimple_call_set_lhs (call_stmt, *to_p);
> >        assign = call_stmt;
> >      }
> 
> Actually in light of #c2 this might be a separate but related issue.

It may be better to check

    TREE_ADDRESSABLE (TREE_TYPE (*to_p))

instead of checking

    gimple_call_return_slot_opt_p (call_stmt)

Because with the latter, we trigger a gimple verification error "LHS in
noreturn call" for the following test case, which utilizes the return-slot
optimization but whose TREE_TYPE in question is not TREE_ADDRESSABLE.

struct R
{
  int x[100];
};

__attribute__ ((noreturn)) R f ();

void
c ()
{
  f ();
}

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