[llvm-commits] [llvm] r157298 - /llvm/trunk/lib/Transforms/Scalar/BoundsChecking.cpp
Nuno Lopes
nunoplopes at sapo.pt
Wed May 23 09:05:35 PDT 2012
Quoting Nick Lewycky <nicholas at mxc.ca>:
> 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.
Well, that's true, but that doesn't make the code correct :)
I agree we should be more careful here.
Nuno
More information about the llvm-commits
mailing list