[llvm-commits] [llvm] r157298 - /llvm/trunk/lib/Transforms/Scalar/BoundsChecking.cpp

Duncan Sands baldrick at free.fr
Wed May 23 00:57:28 PDT 2012


Hi Nuno,

> teach computeAllocSize about realloc, reallocf, and valloc

...

> +      if ((FTy->getParamType(0)->isIntegerTy(32) ||
> +           FTy->getParamType(0)->isIntegerTy(64))&&
> +          (Callee->getName() == "malloc" ||
> +           Callee->getName() == "valloc" ||
> +           Callee->getName() == "_Znwj"  || // operator new(unsigned int)
> +           Callee->getName() == "_Znwm"  || // operator new(unsigned long)
> +           Callee->getName() == "_Znaj"  || // operator new[](unsigned int)
> +           Callee->getName() == "_Znam")) { // operator new[](unsigned long)

shouldn't you query something like TargetLibraryInfo to check that these have
standard semantics.  Otherwise "malloc" might just be some arbitrary function
that has no relationship with C's standard malloc function.  See -fno-builtin.

Ciao, Duncan.



More information about the llvm-commits mailing list