[haiku-development] Re: Disabling Strict Aliasing for GCC4 Builds

  • From: "Michael Lotz" <mmlr@xxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 18 Apr 2008 11:07:10 +0200

Hi Alex

> On a side note, these might also show up in Coverity if that goes
> through... A more permanent fix than disabling the warnings and 
> strict
> aliasing might be better in the long run.

Nobody's desputing that, it's just a lot of work that can't reasonably 
be done right now. But it's not disabling the warnings, it's disabling 
the optimizations that potentially produce this kind of unexpected code 
until we have the time to fix the code.

> Could some of these aliasing conflicts be avoided by using unions?

Yes that is the usual way of handling it (and explicitly allowed by the 
standard). While it is a little clumsy to always use a union to do an 
otherwise "simple conversion", it is the way to write code that can 
take advantage of the strict aliasing rules for optimization.

Regards
Michael

Other related posts: