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

--- Comment #4 from Josef Melcr <jmelcr at gcc dot gnu.org> ---
(In reply to Mikael Pettersson from comment #3)
> I think this is invalid code. A tail-call deliberately discards the current
> stack frame (aka "continuation") restoring the previous one, but the setjmp
> records a reference to it in global scope. That is, you have a dangling
> pointer and any longjmp would be UB.

I think so as well, I am just trying to make sure that this is a clang issue
and it shouldn't accept it.

> The obvious fix while keeping the tail-calls is to put the setjmp in the
> (non-tail) caller of c.

I am not sure the fix would be so simple in the real example, but I will try to
suggest something upstream I suppose.

Reply via email to