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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2026-06-18
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
          Component|middle-end                  |tree-optimization

--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So in this case the setjmp buffer already went out of scope before the
musttail.

GCC takes the easy way out when dealing with setjmp/returns_twice and does not
figure out the handling here.

But maybe for musttail we don't need to reject returns_twice functions right
away.

```
  /* Any function that calls setjmp might have longjmp called from
     any called function.  ??? We really should represent this
     properly in the CFG so that this needn't be special cased.  */
  if (cfun->calls_setjmp)
    {
      maybe_error_musttail (call, _("caller uses setjmp"), diag_musttail);
      return false;
    }
```

We could just reject a taill call for non-musttail call if cfun->calls_setjmp
is set when it comes later on.

This might be an easy thing to implement.

Reply via email to