[cfe-dev] warnings in clang

Sebastian Redl sebastian.redl at getdesigned.at
Fri Nov 14 15:11:14 PST 2008


Argiris Kirtzidis wrote:
> Mike Stump wrote:
>   
>> Here are the warnings from a recent build of clang (-r59324):
>>
>> DeclSerialization.cpp: In member function 'void  
>> clang::ScopedDecl::ReadInRec(llvm::Deserializer&, clang::ASTContext&)':
>> DeclSerialization.cpp:170: warning: dereferencing type-punned pointer  
>> will break strict-aliasing rules
>> DeclSerialization.cpp:171: warning: dereferencing type-punned pointer  
>> will break strict-aliasing rules
>>   
>>     
>
> I'm the one to blame for these. Care to explain more about what is wrong 
> and how to fix it ?
> The offending line is:
>
>     D.ReadUIntPtr(reinterpret_cast<uintptr_t&>(MDC->SemanticDC), 
> SemaDCPtrID);
>
> where 'MDC->SemanticDC' is a pointer (DeclContext*).
>   
What's wrong with D.ReadPtr(MDC->SemanticDC, SemaDCPtrID)? That template 
function does exactly the same thing, but then it's LLVM core's problem, 
not yours.

Sebastian



More information about the cfe-dev mailing list