This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Tricky(?) aliasing question.
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: rus at google dot com (Silvius Rus)
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 11 Jan 2007 13:28:12 -0500 (EST)
- Subject: Re: Tricky(?) aliasing question.
>
> Sergei Organov wrote:
> > Ian Lance Taylor <iant@google.com> writes:
> >
> >> Sergei Organov <osv@javad.com> writes:
> >>
> >>
> >>> Below are two example functions foo() and boo(), that I think both are
> >>> valid from the POV of strict aliasing rules. GCC 4.2 either warns about
> >>> both (with -Wstrict-aliasing=2) or doesn't warn about any (with
> >>> -Wstrict-aliasing), and generates the assembly as if the functions don't
> >>> violate the rules, i.e, both functions return 10.
> >>>
> >> -Wstrict-aliasing=2 is documented to return false positives. Actually
> >> both current versions of -Wstrict-aliasing are pretty bad.
> >>
> >
> > Well, they are indeed bad, but on the other hand I fail to see how to
> > make them pretty without analyzing the entire source of a program, and
> > even then the "effective type of an object" could change at run-time :(
> > Overall, I tend to refrain from blaming gcc too much for weakness of
> > these warnings.
> >
> >
> Third, it only checks C programs (and not C++).
This has not been true for some time now (at least developmental wise).
-- Pinski