[llvm-commits] [llvm] r157298 - /llvm/trunk/lib/Transforms/Scalar/BoundsChecking.cpp
Nick Lewycky
nicholas at mxc.ca
Wed May 23 01:27:42 PDT 2012
Duncan Sands wrote:
> 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.
For that matter, this duplicates the logic in MemoryBuiltin.cpp's
isMallocCall. Perhaps you should extend that.
Nick
More information about the llvm-commits
mailing list