[cfe-commits] -fbounds-checking

Nuno Lopes nunoplopes at sapo.pt
Mon May 7 11:54:37 PDT 2012


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