[cfe-dev] Warnings when building with gcc-4.5

Sebastien Binet binet at cern.ch
Wed May 12 10:55:22 PDT 2010


Excerpts from Christopher Jefferson's message of 2010-05-12 19:40:19 +0200:
> 
> On 12 May 2010, at 18:37, Sebastien Binet wrote:
> 
> > Excerp
> > speaking of GCC-4.5 warnings, I still get the strict-aliasing ones
> > (yes, I saw the thread on the mailing list as well as the use of
> > unions to prevent broken assembly generation)
> > 
> > in "my" codebase (one of the LHC experiments, so maybe not your
> > typical state of the art source code), we usually get rid of those
> > like so: 
> > 
> > template<typename DEST, typename SRC>
> > DEST* hackish_cast(SRC* src)
> > {
> > // lame way of handling const-ness
> > // a proper partial specialization would do just fine
> > const void* cptr = src; 
> > void* ptr = const_cast<void*>(cptr);
> > return reinterpret_cast<DEST*>(ptr);
> > }
> > 
> > would you consider applying a patch with such a modification ?
> 
> Are you sure the warnings are not being produced for a valid reason,
> and might lead to incorrect code?

for LLVM/CLang, I don't know (yet?) although I suspect -from the
previous email thread about that issue- gcc was just over nitpicking.

(for the LHC code I was talking about, yes, we checked the warning
was a red herring)

cheers,
sebastien.
-- 
#########################################
# Dr. Sebastien Binet
# Laboratoire de l'Accelerateur Lineaire
# Universite Paris-Sud XI
# Batiment 200
# 91898 Orsay
#########################################



More information about the cfe-dev mailing list