http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48142
Summary: miscompilation with -mpreferred-stack-boundary=5 -fstack-check=specific Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: zso...@seznam.cz Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 23674 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23674 reduced testcase Output: $ g++ -Os -mpreferred-stack-boundary=5 -fstack-check=specific -fno-omit-frame-pointer testcase.C $ valgrind -q ./a.out ==16640== Invalid read of size 8 ==16640== at 0x4007D0: main (testcase.C:6) ==16640== Address 0xfffffffffffffff8 is not stack'd, malloc'd or (recently) free'd (gdb) i r rsp rsp 0xfffffffffffffff8 0xfffffffffffffff8 (gdb) disassemble 0x00000000004007c6 <+82>: pop %rcx 0x00000000004007c7 <+83>: pop %r10 0x00000000004007c9 <+85>: xor %eax,%eax 0x00000000004007cb <+87>: pop %rbp 0x00000000004007cc <+88>: lea -0x8(%r10),%rsp => 0x00000000004007d0 <+92>: retq End of assembler dump. Tested revisions: r171001 - fail 4.6 r170955 - fail 4.5 r170955 - OK