5 ms·
"No, it's not GCC's fault / doing something weird." :) But, yes. Edited to clarify. FWIW this isn't a new problem either. If you wrote some C code in the 90
by eqvinox 7y ago
"No, it's not GCC's fault / doing something weird." :)
But, yes. Edited to clarify.
FWIW this isn't a new problem either. If you wrote some C code in the 90ies using misaligned pointers, and then tried porting it to, say, a DEC Alpha, you'd get a SIGBUS in your face on first dereferencing such a pointer.
- guenthert 7y agoMC68k (anno 1979) didn't like misaligned memory access either and I have no reasons to believe that this started with Motorola. But yes, it's always fun watching a new generation falling into the old traps.
- hazeii 7y agoIndeed, PDP/11s don't like it. Older ARM designs too, though I believe they allow it since about ARM6 (perhaqps because x86 does?).
- simcop2387 7y agoThe arms allow it since ARMv5, but it's still not quite what one would expect until ARMv7. However it has a significant performance penalty when doing it. https://medium.com/@iLevex/the-curious-case-of-unaligned-access-on-arm-5dd0ebe24965 https://medium.com/@iLevex/the-curious-case-of-unaligned-acc...
- elgfare 7y agoCortex-M0 still does not allow it, and fun fact: Cortex-M4 allows unaligned access, but can be configured run-time to not allow it.
- icedchai 7y agoYes, I remember running into this on the Amiga. The later processors, like the 68020 and 030, removed this restriction.