[Scummvm-devel] Wii & Gamecube (resp. PowerPC) vs. unaligned memory access
Johannes Schickel
lordhoto at scummvm.org
Fri May 6 19:45:32 CEST 2011
> I vaguely remember that it may also have been an aliasing issue, where
> the need_memalign=no path resulted in optimized code from the compiler
> that was not what we expected in certain situations.
>
> So the cause of the issue I ran into somewhere in the distant past may
> not be related to unaligned access, but it made me set need_memalign.
>
> Confusing? Yes. But reading "return *(const uint32 *)(ptr);" makes me
> wonder if need_memalign has a confusing name in the first place. If I
> read GCC's manpage about -fstrict-aliasing right, that may also be
> undefined behaviour.
>
I think starting with GCC 4.0 we use gcc's methods to mark the variables we
use for memory read/write in the endian read stuff as "might alias". This
*should* take care of problems when optimizations are enabled.
// Johannes
More information about the Scummvm-devel
mailing list