[LLVMdev] alloc_size metadata

Duncan Sands baldrick at free.fr
Fri May 25 00:17:58 PDT 2012


Hi Kostya,

>     Tools like ASan and SAFECode *could* use this attribute
>
>
> A case where this may be useful for asan:
>     size_t n, m; ...
>     int *x = new int [n]; ...
>     x[m]  // here we can check "m < n" instead of a more expensive shadow memory
> lookup.

I don't think you need the attribute for this: LLVM already has utilities that
know about malloc and C++'s new.  Can't you just use them?

Ciao, Duncan.



More information about the llvm-dev mailing list