Skip to content

cmd/compile: Illegal instruction 'fucomip' on 386 with GO386=387 #13923

Closed
@Partmedia

Description

@Partmedia

I'm running Go 1.5 on FreeBSD i386 using a "AMD-K6(tm) 3D processor (350.02-MHz 586-class CPU)". I cross-compiled a binary on a modern machine with GOARCH=386 and GO386=387, but the resulting binary crashes:

Program received signal SIGILL, Illegal instruction.
0x0807a395 in runtime.check () at /usr/local/go/src/runtime/runtime1.go:259

Disassembling the problematic instruction reveals:

(gdb) disassemble 0x0807a395 0x0807a396
Dump of assembler code from 0x807a395 to 0x807a396:
0x0807a395 <runtime.check+821>: fucomip %st(1),%st
End of assembler dump.

The documentation advertises:

GO386=387: use x87 for floating point operations; should support all x86 chips (Pentium MMX or later).

MMX is supported, as indicated by the CPU features string:

CPU: AMD-K6(tm) 3D processor (350.02-MHz 586-class CPU)
  Origin="AuthenticAMD"  Id=0x58c  Family=0x5  Model=0x8  Stepping=12
  Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX>
  AMD Features=0x80000800<SYSCALL,3DNow!>

This contradicts the documentation; either the documentation should indicate that not all processors with MMX are supported, or the 'fucomip' instruction (and friends) should not be emitted when GO386=387 is set.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions