http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59405
Bug ID: 59405 Summary: Incorrect FP<->MMX transition during call/ret Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kirill.yukhin at intel dot com Hello, Attached test reproduces the error: $ gcc -m32 -mmmx 1.c $ ./a.out Aborted (core dumped) Disassembly of the foo is: foo32x2_be: .LFB0: pushl %ebp # 22 *pushsi2 [length = 1] movl %esp, %ebp # 23 *movsi_internal/1 [length = 2] subl $16, %esp # 24 pro_epilogue_adjust_stack_si_add/1 [length = 3] movq %mm0, -8(%ebp) # 3 *movv2sf_internal/9 [length = 4] movl -4(%ebp), %eax # 7 *movsf_internal/4 [length = 3] movl %eax, -12(%ebp) # 14 *movsf_internal/5 [length = 3] flds -12(%ebp) # 21 *movsf_internal/1 [length = 3] leave # 27 leave [length = 1] ret # 28 simple_return_internal [length = 1] We're passing v2sf vector using MMX register, which aliased to x87 stack. Then we're trying to load FP to it, which leds to NaN. As far as I understand, we need `emms' instruction between last MMX use and before first x87 use. Reproduces everywhere, up to 4.7.2 (may be earlier, I have no such).