> > Sergei Organov wrote: > > Ian Lance Taylor <[EMAIL PROTECTED]> writes: > > > >> Sergei Organov <[EMAIL PROTECTED]> 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