Re: warning: dereferencing type-punned pointer will break strict-aliasing rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brian Dessent wrote:
Jeffrey Holle wrote:

On release builds, wxWidgets code emits a lot of these warnings:
   warning: dereferencing type-punned pointer will break strict-aliasing
rules

Questions:

   1.  Are these warnings benign?  If so can they be suppressed?
   2.  If not, what level of optimization should I regress to avoid these
warnings?

I would certainly not ignore them.  They indicate that the code being
compiled probably violates the ISO C standard rules for type aliasing,

which _may_ break the aliasing rules.

If you examine the code being warned about, and find it benign, you may insert an intermediate void * cast to silence the warning.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@xxxxxxxxxxxxxxxx    ::     http://www.planetfall.pwp.blueyonder.co.uk


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux