[cfe-commits] -fbounds-checking

Nuno Lopes nunoplopes at sapo.pt
Mon May 7 14:09:30 PDT 2012


Hi,

So the main idea of this new flag is not for debugging, but rather for  
production.
This means that we won't be able to perform as many checks as  
AddressSanitizer, but the performance is supposed to be acceptable for  
binaries that are shipped for production.

About Joerg's email, this feature is agnostic to the allocation  
function. It's then the job of LLVM to lower objectsize conveniently,  
which is what I'll be working on next.

Nuno


> Have you looked at AddressSanitizer?
> http://clang.llvm.org/docs/AddressSanitizer.html
>
> On Mon, May 7, 2012 at 11:54 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>
>> Hi,
>>
>> I would like to add a new option to clang: -fbounds-checking. It emits
>> run-time bounds checks for array/pointers dereferencing based on
>> LLVM's object size built-in. The code to emit the checks is already in
>> clang; it's just a matter of wiring the flag.
>> The other change is to make -fcatch-undefined-behavior imply
>> -fbounds-checking (so that it keeps doing these kinds of checks).
>>
>> This flag supports an additional integer parameter to control the
>> amount of run-time performance penalty you're willing to afford. For
>> example, -fbounds-checking=1 will only resolve stuff at compile-time,
>> while at level 2 it can defer some stuff to run-time. This will come
>> in a separate patch to LLVM.
>>
>> Comments, ideas, etc?
>>
>> Thanks,
>> Nuno



More information about the cfe-commits mailing list