This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]