------- Comment #4 from rguenth at gcc dot gnu dot org 2010-08-06 13:55 ------- (In reply to comment #3) > Maybe I should add that the 0.6.0-beta1 release in GIT passed uintptr_t - > sized > structures by value and the compiler spotted the aliasing, which is why I > introduced the pointer -> uintptr_t -> pointer hacks to begin with. > > Without passing structs by value the compiler doesn't report the aliasing > problems. > > I'm being sincere when I say that if the compiler really can't spot aliasing > problems then -fno-strict-aliasing should be on by default.
The compiler can spot all aliasing that is permitted by the language standard. If you are writing non-C code then you need to tell that to the compiler via -fno-strict-aliasing. Merely adding hacks to avoid the diagnostic (which can't be perfect, if we could detect the aliasing we wouldn't optimize based on the fact that it isn't there). -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45204