------- Comment #6 from jakub at gcc dot gnu dot org 2008-11-03 16:17 ------- 4.2 doesn't realign stack except for main, only gcc 4.4 does and only for alignments larger than 16 bytes (and only on i386/x86_64). You can use an optimization barrier to force a check, but I think it is a bad idea to slow down a library just because users might call it with bad stack alignment, using -mpreferred-stack-boundary is an ABI switch, people who mix code with different ABIs get what they deserve. Say uintptr_t aladdr = (uintptr_t) altest; asm ("" : "+r" (aladdr)); if ((aladdr & 15) != 0) puts ("stack not properly aligned");
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38001