[Scummvm-devel] Wii & Gamecube (resp. PowerPC) vs. unaligned memory access

yotam barnoy yotambarnoy at gmail.com
Mon May 9 12:41:10 CEST 2011


> Regarding 1: We rely on casts that violate aliasing rules in *tons* of places. So besides all else, we may want to recommend to all porters to add -fno-strict-aliasing, or even automatically add that to CXXFLAGS (when using GCC or any other compiler supporting this).
> Any reason not to do so?

Though we violate aliasing rules in many places, I've only ever
experienced an aliasing bug with the endian.h file. That was one of
the worst bugs I ever had to debug btw. It's possible of course that
there may be other bugs waiting to be found, but I think that even
though gcc says it must have strict aliasing, in reality the gcc guys
realize that they can't just go and break a ton of code, all of which
violates strict aliasing. So 95% of the time there's no issue.

The reason not to remove -fno-strict-aliasing is performance. At
least, last time we talked about aliasing, I suggested using
-fno-strict-aliasing, and everyone replied that it would cause serious
slowdown.

Yotam




More information about the Scummvm-devel mailing list