On Thu, Jul 18, 2024 at 04:18:56PM -0700, Andi Kleen wrote:
> > > > > + set_musttail_on_return (retval, xloc, musttail_p);
> > > > > +
> > > > > if (retval)
> > > > > {
> > > > > tree semantic_type = NULL_TREE;
> > > >
> > > > Is it deliberate that set_musttail_on_return is called outside the
> > > > if (retval) block? If it can be moved into it, set_musttail_on_return
> > > > can be simplified to assume that retval is always non-null.
> > >
> > > Yes it can be removed.
>
> Actually I was wrong here, after double checking. The !retval case is
> needed to diagnose a [[musttail]] set on a plain return (which is not
> allowed following the clang spec)
>
> So the call has to be outside the check.
>
> The C frontend did it correctly, but the C++ part did not (fixed now)
Ah, fair enough. Just make sure we test it somewhere, thanks.
Marek