This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]