Created attachment 41809 [details] reduced test case Attached file (reduced test case from string-to-double conversion routine in Firefox 54.0.1) aborts when compiled with: gcc -m32 -O2 wrong-code.c It's fine when compiled with -O1 or without -m32.
(triggers with -march=prescott|haswell, not with -march=i686)
Created attachment 41811 [details] alternate, further reduced test case bug occurs with: -O2 -m32 -march=i686 -msse2 -mfpmath=387 but not with: -O2 -m32 -march=i686 -msse2 -mfpmath=sse
Most likely a dup of bug 323.
(In reply to Andrew Pinski from comment #3) > Most likely a dup of bug 323. I don't think so, unless I'm misunderstanding something. There's no rounding in the test case, just a store of an int value to a double variable, and furthermore the result is _completely_ wrong, not just off by a bit.
Generated assembly looks like it's grabbing garbage off the stack and writing it to b: a: subl $20, %esp fildl 24(%esp) movsd (%esp), %xmm1 movsd %xmm1, b [...]
(In reply to mednafen from comment #2) > Created attachment 41811 [details] > alternate, further reduced test case Works OK for me with: -O2 -m32 -march=i686 -msse2 -mfpmath=387 a: subl $20, %esp fildl 24(%esp) cmpl $10, 24(%esp) fstpl (%esp) movq (%esp), %xmm0 movsd (%esp), %xmm1 movq %xmm0, 8(%esp) movsd %xmm1, b jg .L1 xorl %eax, %eax movl %eax, 12(%esp) movsd 8(%esp), %xmm2 movsd %xmm2, (%esp) .L1: fldl (%esp) addl $20, %esp ret .ident "GCC: (GNU) 7.1.1 20170718 [gcc-7-branch revision 250314]"
(In reply to Uroš Bizjak from comment #6) > > Works OK for me with: > > .ident "GCC: (GNU) 7.1.1 20170718 [gcc-7-branch revision 250314]" Reported against 7.1.0. It may well be fixed already on the branch/trunk; in that case I would suggest adding a regression test if it is not otherwise a known bug and closing as resolved.
This problem disappears when I apply the fix for #80706 (as applied to GCC 7 branch). Possibly this is a duplicate of that issue.
Dup of bug 80706 then. *** This bug has been marked as a duplicate of bug 80706 ***