[llvm-dev] returns_twice / noreturn
Sanjoy Das via llvm-dev
llvm-dev at lists.llvm.org
Sun Nov 5 13:01:52 PST 2017
On Fri, Nov 3, 2017 at 6:06 PM, Hal Finkel via llvm-dev
> That's correct. The relevant semantics here come from C's setjmp/longjmp,
> and there's an exception in that language to deal with this situation:
> 126.96.36.199p3: "All accessible objects have values, and all other components of
> the abstract machine have state, as of the time the longjmp function was
> called, except that the values of objects of automatic storage duration that
> are local to the function containing the invocation of the corresponding
> setjmp macro that do not have volatile-qualified type and have been changed
> between the setjmp invocation and longjmp call are indeterminate."
> We should probably import some version of this into the LangRef to
> more-accurately describe returns_twice/noreturn (because that's what we
> actually implement in this regard).
We do not implement that restricted semantics correctly either -- see
IMO the Right(TM) fix is to add a CFG edge from all possibly
longjmp'ing function calls to all setjmps in a function. We can
probably do this by modeling the possibly longjmp'ing calls as invokes
that unwind to a special "setjmp" landingpad.
More information about the llvm-dev