[cfe-dev] warnings in clang

Argiris Kirtzidis akyrtzi at gmail.com
Fri Nov 14 14:55:51 PST 2008


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*).

-Argiris



More information about the cfe-dev mailing list