[cfe-commits] r171947 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGen/catch-undef-behavior.c test/CodeGen/compound-assign-overflow.c

Will Dietz wdietz2 at illinois.edu
Tue Jan 8 19:53:05 PST 2013


On Tue, Jan 8, 2013 at 9:46 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Tue, Jan 8, 2013 at 7:39 PM, Will Dietz <wdietz2 at illinois.edu> wrote:
>> Author: wdietz2
>> Date: Tue Jan  8 21:39:41 2013
>> New Revision: 171947
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=171947&view=rev
>> Log:
>> [ubsan] Make static check data non-const so it can be used for deduplication.
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/CGExpr.cpp
>>     cfe/trunk/test/CodeGen/catch-undef-behavior.c
>>     cfe/trunk/test/CodeGen/compound-assign-overflow.c
>>
>> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=171947&r1=171946&r2=171947&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Jan  8 21:39:41 2013
>> @@ -1992,7 +1992,7 @@
>>
>>    llvm::Constant *Info = llvm::ConstantStruct::getAnon(StaticArgs);
>>    llvm::GlobalValue *InfoPtr =
>> -      new llvm::GlobalVariable(CGM.getModule(), Info->getType(), true,
>> +      new llvm::GlobalVariable(CGM.getModule(), Info->getType(), false,
>>                                 llvm::GlobalVariable::PrivateLinkage, Info);
>>    InfoPtr->setUnnamedAddr(true);
>
> If you want the address to be unique, just get rid of the
> setUnnamedAddr() call... no need to fiddle with the const-ness.
>
> -Eli

Interesting, didn't know that, was wondering the reason for the
setUnnamedAddr() :).  For this case however, they need to be non-const
since the runtime marks them in-place to track that they've already
triggered.

Thanks!

~Will



More information about the cfe-commits mailing list