Patch: New implementation of -Wstrict-aliasing

Silvius Rus rus@google.com
Thu Feb 1 20:25:00 GMT 2007


On 01 Feb 2007 05:01:00 -0600, Gabriel Dos Reis <gdr@cs.tamu.edu> wrote:
> Do you have some data about the relative cost (in terms of
> compiler-time) of level 2 vs level 3?  This is for decidiing which
> should be the default.

Hi Gaby,

The compile time difference from level 2 vs level 3 appears to be
insignificant at both -O0 and -O2 (see timing results below).  The
only potential serious source of overhead would be the points-to based
analysis, which only runs at -O2 or higher.  However, the overhead
turns out to be very low because the points-to information is highy
preprocessed by pass_may_alias.  The warning pass looks only at
pointers that are both aliased and known to be dereferenced in the
current function.  Also, level 2 may end up looking at more conversion
expressions because it does not check whether pointers are referenced,
so in some cases level 2 could actually be slightly more expensive
than level 3.

Let me know if you agree with default = level 3.

Is there a standard way to measure GCC's compilation overhead?  Here
are the timing results from building GMP on i686 (all times in
seconds):

-O0:
54.069
-O0 -fstrict-aliasing:
54.948
-O0 -fstrict-aliasing -Wstrict-aliasing=2:
55.699
-O0 -fstrict-aliasing -Wstrict-aliasing=3:
55.657

-O2:
67.253
-O2 -fstrict-aliasing:
68.071
-O2 -fstrict-aliasing -Wstrict-aliasing=2:
68.852
-O2 -fstrict-aliasing -Wstrict-aliasing=3:
68.886

> Many thanks for doing this.
> -- Gaby

I am happy to help.
Silvius



More information about the Gcc-patches mailing list