GCC 12.1 Released
GCC 12.1 Released
Posted May 9, 2022 23:27 UTC (Mon) by foom (subscriber, #14868)In reply to: GCC 12.1 Released by Sesse
Parent article: GCC 12.1 Released
Yeah, the usual case that trips folks up is when they lie to the compiler and claim larger alignment but then don't actually provide it. (e.g. using __attribute__((aligned(16))) but then use a custom allocator which only provides 8byte aligned memory.)
The compiler believes what you tell it, and will emit instructions or do optimizations that depend upon that claimed alignment. But it won't _always_ choose instructions that will trap, so depending on optimizations you can get away with the incorrectly specified alignment until a future compiler upgrade causes a different instruction choice.
