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

--- Comment #3 from Mikael Pettersson <mikpelinux at gmail dot com> ---
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.

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

Reply via email to