GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2021-05-13T01:55:47Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/19680case over signum of Integer is incorrect in GHC 9.22021-05-13T01:55:47ZBodigrimcase over signum of Integer is incorrect in GHC 9.2## Summary
`case` over `signum` of `Integer` returns an incorrect result.
## Steps to reproduce
```
GHCi, version 9.2.0.20210331: https://www.haskell.org/ghc/ :? for help
ghci> signum (-1 :: Integer)
-1
ghci> case signum (-1 :: Integ...## Summary
`case` over `signum` of `Integer` returns an incorrect result.
## Steps to reproduce
```
GHCi, version 9.2.0.20210331: https://www.haskell.org/ghc/ :? for help
ghci> signum (-1 :: Integer)
-1
ghci> case signum (-1 :: Integer) of 1 -> "FOO"; -1 -> "OK"; 0 -> "BAR"; _ -> "FAIL"
"FAIL"
```
## Expected behavior
I would expect the second line to return `"OK"`.
## Environment
* GHC version used: 9.2.0.202103319.2.1Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/19264hgmp-0.1.2 panics on HEAD (lookupGlobal) due to mismatched GHC/Num/BigNat.hi2021-02-01T13:53:00ZRyan Scotthgmp-0.1.2 panics on HEAD (lookupGlobal) due to mismatched GHC/Num/BigNat.hi_Originally observed on a `head.hackage` CI build [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/563516#L6940)._
Attempting to build the `hgmp-0.1.2` package with GHC HEAD (at commit b18d9e97252c9dd12f08d3e6f56bfec6a6d2469a) ..._Originally observed on a `head.hackage` CI build [here](https://gitlab.haskell.org/ghc/head.hackage/-/jobs/563516#L6940)._
Attempting to build the `hgmp-0.1.2` package with GHC HEAD (at commit b18d9e97252c9dd12f08d3e6f56bfec6a6d2469a) triggers a panic. To reproduce, do the following:
```
$ cabal repl -b hgmp -w ~/Software/ghc-9.1.20210124/bin/ghc --constraint="hgmp==0.1.2" --allow-newer=base,ghc-prim
Resolving dependencies...
Build profile: -w ghc-9.1.20210124 -O1
In order, the following will be built (use -v for more details):
- hgmp-0.1.2 (lib) (requires build)
- fake-package-0 (lib) (first run)
Starting hgmp-0.1.2 (lib)
Building hgmp-0.1.2 (lib)
Failed to build hgmp-0.1.2.
Build log (
/home/ryanglscott/.cabal/logs/ghc-9.1.20210124/hgmp-0.1.2-40e5acddb0bd81ddbcf00e2606c0cf5908c10258cb69ed9e9609bda285e2d340.log
):
Configuring library for hgmp-0.1.2..
Preprocessing library for hgmp-0.1.2..
Building library for hgmp-0.1.2..
[1 of 4] Compiling Numeric.GMP.Types ( dist/build/Numeric/GMP/Types.hs, dist/build/Numeric/GMP/Types.o, dist/build/Numeric/GMP/Types.dyn_o )
src/Numeric/GMP/Types.hsc:14:1: warning: [-Wunused-imports]
The import of ‘Data.Typeable’ is redundant
except perhaps to import instances from ‘Data.Typeable’
To import instances alone, use: import Data.Typeable()
|
14 | import Data.Typeable
| ^^^^^^^^^^^^^^^^^^^^
src/Numeric/GMP/Types.hsc:20:36: warning: [-Wunused-imports]
The import of ‘nullPtr’ from module ‘Foreign’ is redundant
|
20 | import Foreign (Storable(..), Ptr, nullPtr, plusPtr)
| ^^^^^^^
ghc: panic! (the 'impossible' happened)
(GHC version 9.1.20210124:
lookupGlobal
Bad interface file: /home/ryanglscott/Software/ghc-9.1.20210124/lib/../lib/x86_64-linux-ghc-9.1.20210124/ghc-bignum-1.0/GHC/Num/BigNat.hi
mismatched interface file profile tag (wanted "dyn", got "")
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Tc/Utils/Env.hs:155:32 in ghc:GHC.Tc.Utils.Env
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
cabal: Failed to build hgmp-0.1.2 (which is required by fake-package-0). See
the build log above for details.
```
This is a regression from GHC 9.0 and earlier. I haven't quite figured out how to minimize the example yet, unfortunately.
This appears to be `ghc-bignum`–related, so perhaps @hsyl20 might know what is happening here?9.2.1