[LLVMdev] aborting on invalid code

Chris Lattner clattner at apple.com
Mon Oct 13 13:16:29 PDT 2008


On Oct 13, 2008, at 1:10 PM, Robert Zeh wrote:

>
> On Oct 13, 2008, at 1:07 PM, Chris Lattner wrote:
>>
>> Exceptions have a high cost in terms of code size, binary size, and
>> even a bit of execution time.  Also, they don't magically make the
>> code safe from any error: code has to be designed specifically to use
>> RAII and other techniques to handle exceptions properly.  Reading a  
>> C+
>> + trade magazines/books about EH topics will give you an idea of the
>> complexity involved in doing it right.  Further, as I mentioned up-
>> thread, turning aborts into exception throws won't save you from null
>> pointer or garbage pointer dereferences.
>
>
> You can catch the null pointer and garbage pointer dereferences with a
> signal handler (in Linux land, at least), and then invoke your direct
> reporting mechanism with that.  Is the concern that some of the other
> LLVM clients don't have signal handling?

Garbage/dangling pointers can corrupt memory, they don't always trap.   
C just isn't a safe programming language (though there are many  
interesting research projects that can help).

-Chris 



More information about the llvm-dev mailing list