[llvm-dev] returns_twice / noreturn

Yichao Yu via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 5 18:22:47 PST 2017

> We do not implement that restricted semantics correctly either -- see
> https://bugs.llvm.org/show_bug.cgi?id=27190

Haha, I wondered for a minute whether I should bring up that bug...
We've seen pretty nasty crashes due to it and had to work around

One of my recent work has also uncovered another (I believe) invalid
handling of returns_twice functions....
noalias returns seems to be treated as stack allocation but is not
required by either LangRef or C standard to be so for returns_twice
function handling....

> 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.

This seems to be a way to handle setjmp without requiring volatile
anywhere? We've thought about doing that ourselves a little but
decided that it was too complicated compare to the left over issue
after the crash was worked around and it's also hard to make it handle
longjmp's from signal handlers very well....

More information about the llvm-dev mailing list