[PATCH util-macros 1/2] Don't disable strict aliasing (-fno-strict-aliasing) globally

Mark Kettenis mark.kettenis at xs4all.nl
Mon Nov 1 03:32:20 PDT 2010


> From: Michel =?ISO-8859-1?Q?D=E4nzer?= <michel at daenzer.net>
> Date: Mon, 01 Nov 2010 08:18:51 +0100
> 
> On Son, 2010-10-31 at 15:54 -0700, Jeremy Huddleston wrote: 
> > Resurrecting this thread as I just realized it was never actually fixed.
> > 
> > I propose we actually follow up on these changes. We should remove
> > -fno-strict-aliasing from XORG_CWARNFLAGS and only add them to the
> > modules that actually require it. We can start out consercatively by
> > adding it to the modules listed in the email below (as well as the
> > xf86-* drivers that historically had the flag which I didn't check at
> > the time of the first email... I know intel needs it)
> 
> I still haven't seen any measurements showing any benefits from making
> this change. Are there any?

I think Michael is asking a very good question here.  The strict
aliasing rules introduced in C99 have always been somewhat
controversial.  They get in the way for lots of low-level programming
tasks such as protocol decoding and frame buffer manipulations.  And
at least in my opinion the rules are simply hard to understand; I need
to read up on the issue again every time it pops up.

I may be somewhat overcautious, but I would keep -fno-strict-aliasing
as a default.  And I'd only enable -fstrict-aliasing for particular
bits of code where it has a significant performance benefit, and
people have done a careful analysis of the code to see if it is free
of aliasing issues.


More information about the xorg-devel mailing list