Hi all, I'm experiencing a strange gfortran bug, i686-pc-mingw32 specific, with options -march=pentium4 -mfpmath=sse -msse. I reproduce it below, and post it here before filing it because I can't manage to create a C testcase, and have no idea if this is something already known (though my bugzilla searches didn't return successful results).
$ cat a.f90 real(8) :: x x = 2._8 print *, sqrt(x) end $ gfortran.exe a.f90 -mfpmath=sse -msse -march=i686 -O0 && a 1.41421356237310 $ gfortran.exe a.f90 -mfpmath=sse -msse -march=pentium4 -O0 && a [pops up a crash window, win32 equivalent of a segfault] Debugging leads to an endless loop of: > gdb: do_initial_child_stuff: process 2284 > gdb: kernel event for pid=2284 tid=2264 code=CREATE_PROCESS_DEBUG_EVENT) > gdb: child_resume.SetThreadContext: thread 2284.0x8d8 > ContinueDebugEvent (cpid=2284, ctid=2264, DBG_CONTINUE); The difference in the assembly created in both cases: $ diff -pu a.s.working a.s.crashing --- a.s.working Mon Apr 24 16:11:00 2006 +++ a.s.crashing Mon Apr 24 16:11:12 2006 @@ -13,8 +13,8 @@ _MAIN__: pushl %ebp movl %esp, %ebp subl $312, %esp - fldl LC0 - fstpl -8(%ebp) + movsd LC0, %xmm0 + movsd %xmm0, -8(%ebp) movl $LC1, -280(%ebp) movl $3, -276(%ebp) movl $6, -284(%ebp) @@ -22,9 +22,8 @@ _MAIN__: leal -288(%ebp), %eax movl %eax, (%esp) call __gfortran_st_write - fldl -8(%ebp) - fsqrt - fstpl -16(%ebp) + sqrtsd -8(%ebp), %xmm0 + movsd %xmm0, -16(%ebp) movl $8, 8(%esp) leal -16(%ebp), %eax movl %eax, 4(%esp) I tried to make C testcases based on the generated code/original dump: MAIN__ () { real8 x; x = 2.0e+0; x = __builtin_sqrt (x); } but they all work. Does anyone have any idea why all this is happening? Thanks, FX