[LLVMdev] Is LLVM expressive enough to represent asynchronous exceptions?

Eric Botcazou ebotcazou at adacore.com
Tue Jun 14 16:15:44 PDT 2011


> Hi Chris, I've CC'd Eric Botcazou in the hope that he will clear up just
> what the Ada front-end needs from the rest of the compiler as far as
> asynchronous exceptions are concerned.

We actually support synchronous exceptions only.  Just standard support for 
non-call exceptions (-fnon-call-exceptions) plus augmented unwind tables 
(-fasynchronous-unwind-tables) is required.  Essentially like for Java.

> For SIGILL, SIGSEGV and SIGBUS, I think the program has to be erroneous [*]
> to get one of these in the first place (note that null pointer dereferences
> and other things corresponding to "bounded errors" in Ada parlance [**] do
> not cause a segfault because the compiler inserts code to check for a null
> pointer before every dereference and explicitly raises an exception if the
> pointer is null), so I suspect that the compiler tries to do something
> (raise an exception) because it is helpful (quality of implementation)
> rather than because the language requires it.

A conformant Ada compiler is required to do stack checking (a few ACATS tests 
check it) and handle the Storage_Error.  Of course you can implement it the 
way you like, but we try to do it properly on systems with MMU: probe the 
stack, hit the guard pages, catch the SIGSEGV and turn it into an exception 
that you can in turn catch.  Needless to say, lots of gory details in there.

-- 
Eric Botcazou



More information about the llvm-dev mailing list