warning: dereferencing type-punned pointer will break strict-aliasing rules
Nathan Sidwell
nathan@codesourcery.com
Thu Jul 26 18:12:00 GMT 2007
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
More information about the Gcc-help
mailing list