[llvm] r252617 - Fix asan warning (NFC)

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 22:24:23 PST 2015


yep, there is no recover mode for address sanitizer.

Except that address sanitizer gives this hint at the end -- notice the word
'warning':

==11479==HINT: if you don't care about these warnings you may set
ASAN_OPTIONS=alloc_dealloc_mismatch=0

David



On Tue, Nov 10, 2015 at 10:10 PM, Sean Silva <chisophugis at gmail.com> wrote:

>
>
> On Tue, Nov 10, 2015 at 9:11 AM, Xinliang David Li via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: davidxl
>> Date: Tue Nov 10 11:11:33 2015
>> New Revision: 252617
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=252617&view=rev
>> Log:
>> Fix asan warning (NFC)
>>
>>
> FYI, Asan reports are errors, not warnings.
>
> -- Sean Silva
>
>
>> Modified:
>>     llvm/trunk/lib/ProfileData/InstrProf.cpp
>>
>> Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=252617&r1=252616&r2=252617&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
>> +++ llvm/trunk/lib/ProfileData/InstrProf.cpp Tue Nov 10 11:11:33 2015
>> @@ -247,8 +247,9 @@ void ValueProfData::deserializeTo(InstrP
>>  std::unique_ptr<ValueProfData>
>>  ValueProfData::serializeFrom(const InstrProfRecord &Record) {
>>    uint32_t TotalSize = getSize(Record);
>> -  std::unique_ptr<ValueProfData> VPD(
>> -      reinterpret_cast<ValueProfData *>(new char[TotalSize]));
>> +  void *RawMem = ::operator new(TotalSize);
>> +  ValueProfData *VPDMem = new (RawMem) ValueProfData();
>> +  std::unique_ptr<ValueProfData> VPD(VPDMem);
>>
>>    VPD->TotalSize = TotalSize;
>>    VPD->NumValueKinds = Record.getNumValueKinds();
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151110/1536adb4/attachment.html>


More information about the llvm-commits mailing list