Boost logo

Geometry :

Subject: Re: [geometry] GCC 4.4.7 and strict aliasing warnings
From: Patrick J. LoPresti (lopresti_at_[hidden])
Date: 2014-10-28 12:28:38

Adam Wulkiewicz writes:

> Patrick J. Lopresti wrote:
>> (Using the develop branch)
> Which version of Boost are you using? 1.56?

"the develop branch" :-)

> In the file
> line 168:
> return p.template get<Dimension>();
> Here a member function template instantiation is called.
> If the compiler complains about the above it's probably a bug in the
> compiler.

It certainly looks that way. Later versions of GCC do not warn.

The only hack I found around it is to create a local variable q,
memcpy() from p into q, then "return q.template
get<Dimension>()". Unfortunately, there are other instances of the
warning that are not so easy to hack around... Not to mention the
performance hit.

> Maybe related to this:

Yes, it appears GCC 4.4 generates many bogus instances of this warning,
and nobody intends to fix it, even though this is the GCC in RHEL 6 (all
versions, all updates). Red Hat's own approach seems to be to add
"-fno-strict-aliasing" to the compiler options for all of their

Also GCC 4.4 does not have "#pragma GCC diagnostic [push/pop]", so there
is no clean way to disable the warning just around the Boost.Geometry
code. So I suppose I will disable it globally.

Thanks once again, Adam.

 - Pat

Geometry list run by mateusz at