Skip to content

cgrun071 is broken on i386

It looks like cgrun071, which tests the popcnt primops, is broken on i386. In optasm the failure takes the form of ill-formed assembler output:

=====> cgrun071(optasm) 369 of 7138 [0, 0, 0]
cd "codeGen/should_run/cgrun071.run" &&  "/builds/ghc/ghc/inplace/bin/ghc-stage2" -o cgrun071 cgrun071.hs -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -msse4.2 -O -fasm < 
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main             ( cgrun071.hs, cgrun071.o )

cgrun071.hs:42:24: warning: [-Wdeprecations (in -Wdefault)]
    In the use of ‘bitSize’ (imported from Data.Bits):
    Deprecated: "Use 'bitSizeMaybe' or 'finiteBitSize' instead"
/tmp/ghc2523_0/ghc_4.s: Assembler messages:

/tmp/ghc2523_0/ghc_4.s:4116:0: error:
     Error: unsupported instruction `movq'

/tmp/ghc2523_0/ghc_4.s:4230:0: error:
     Error: unsupported instruction `movq'

...


/tmp/ghc2523_0/ghc_4.s:6003:0: error:
     Error: unsupported instruction `movq'
`cc' failed in phase `Assembler'. (Exit code: 1)

*** unexpected failure for cgrun071(optasm)

Whereas in the profasm way it triggers assertions in the NCG:

=====> cgrun070(profasm) 369 of 7138 [0, 1, 0]
cd "codeGen/should_run/cgrun070.run" &&  "/builds/ghc/ghc/inplace/bin/ghc-stage2" -o cgrun070 cgrun070.hs -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output  -O -prof -static -fprof-auto < 
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main             ( cgrun071.hs, cgrun071.o )

cgrun071.hs:42:24: warning: [-Wdeprecations (in -Wdefault)]
    In the use of ‘bitSize’ (imported from Data.Bits):
    Deprecated: "Use 'bitSizeMaybe' or 'finiteBitSize' instead"
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.9.0.20190925:
	getRegister(x86)
  I64[R1 + 11]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
        pprPanic, called at compiler/nativeGen/X86/CodeGen.hs:1054:26 in ghc:X86.CodeGen

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug


*** unexpected failure for cgrun071(profasm)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information