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

Jeremy Huddleston jeremyhu at apple.com
Mon Nov 1 12:17:58 PDT 2010


>> 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.

The point I'm trying to make here is that:

1) It is *NOT* a warning flag.  Using CWARNFLAGS should *only* enable warnings, not change the resulting assembly.

2) It was never intended to be in all of the modules.  It landed there by accident when the code was copy/pasted from one configure.ac to another and then into util-macros.

3) Performance gains are not in consideration here.




More information about the xorg-devel mailing list