Some HelenOS code breaks strict aliasing rules
According to GCC man page, -fstrict-aliasing is always active for optimization leves -O2, -O3 and -Os. This means HelenOS is compiled with strict aliasing active. But some code in HelenOS does not observe strict aliasing.
GCC strict aliasing rule requires all code to observe aliasing rules as defined by C99 with only one exception — type punning is allowed through the union type. Specifically type punning is disallowed through pointers.
C99 requires that any variable can only be accessed as one specific type, or as char (via char pointer). Important note is that this applies GLOBALLY, not just within the scope of a function or module.
Code in HelenOS that is suspect of breaking strict aliasing rules:
- memcpy() (unaligned memcpy should be OK, but the aligned version is not)
- drawing routines
Code not observing the aliasing rules can break any time. Thus such code must be identified and fixed ASAP. If you have any suspicion about code breaking the aliasing rules, please let me know.