GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2023-05-04T14:39:04Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/23280JavaScript: `zipWithEqual: unequal lists: assignAllEqual` panic2023-05-04T14:39:04ZJosh MeredithJavaScript: `zipWithEqual: unequal lists: assignAllEqual` panicWhen compiling with the JavaScript backend, the `RepPolyWrappedVar2` test can fail with the following output:
```
Compile failed (exit code 1) errors were:
javascript-unknown-ghcjs-ghc: panic! (the 'impossible' happened)
GHC version 9...When compiling with the JavaScript backend, the `RepPolyWrappedVar2` test can fail with the following output:
```
Compile failed (exit code 1) errors were:
javascript-unknown-ghcjs-ghc: panic! (the 'impossible' happened)
GHC version 9.7.20230418:
zipWithEqual: unequal lists: assignAllEqual
CallStack (from HasCallStack):
panic, called at compiler/GHC/Utils/Misc.hs:248:36 in ghc:GHC.Utils.Misc
zipWithEqual, called at compiler/GHC/Utils/Misc.hs:246:44 in ghc:GHC.Utils.Misc
zipWithEqual, called at compiler/GHC/JS/Make.hs:516:33 in ghc:GHC.JS.Make
assignAllEqual, called at compiler/GHC/StgToJS/Utils.hs:25:3 in ghc:GHC.StgToJS.Utils
```9.6.2Josh MeredithJosh Meredithhttps://gitlab.haskell.org/ghc/ghc/-/issues/19700regression in GHC 9.0.1: panic converting to STG2023-04-27T09:04:38Zinfinity0regression in GHC 9.0.1: panic converting to STGFrom https://github.com/haskellari/strict-containers/runs/2338209240?check_suite_focus=true
~~~~
[13 of 29] Compiling Data.Strict.HashMap.Autogen.Internal.Strict ( src/Data/Strict/HashMap/Autogen/Internal/Strict.hs, /__w/strict-containe...From https://github.com/haskellari/strict-containers/runs/2338209240?check_suite_focus=true
~~~~
[13 of 29] Compiling Data.Strict.HashMap.Autogen.Internal.Strict ( src/Data/Strict/HashMap/Autogen/Internal/Strict.hs, /__w/strict-containers/strict-containers/dist-newstyle/build/x86_64-linux/ghc-9.0.1/strict-containers-0.1/build/Data/Strict/HashMap/Autogen/Internal/Strict.o, /__w/strict-containers/strict-containers/dist-newstyle/build/x86_64-linux/ghc-9.0.1/strict-containers-0.1/build/Data/Strict/HashMap/Autogen/Internal/Strict.dyn_o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.0.1:
CoreToStg.myCollectArgs
(\ (@v2_aW5m) (@k_aW5k) -> case undefinedElem of { })
@v2_aW5m @k_aW5k
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Outputable.hs:1230:37 in ghc:GHC.Utils.Outputable
pprPanic, called at compiler/GHC/CoreToStg.hs:938:33 in ghc:GHC.CoreToStg
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
~~~~
The crash is not transient, it recurs when I re-run the job.
The [commit causing the crash](https://github.com/haskellari/strict-containers/commit/7cc8222313915190b0a8cb8a799f19a335bad567#diff-d4a28774a0add1e4bb5b80febf2e8af418ab5dc44cd302940a1ac1fb0a62685b) only adds a bunch of strictness annotations, though it is operating on a primitive array.
This may or may not be related to #12161, but the code causing the crash here is fairly normal user code.9.0.2https://gitlab.haskell.org/ghc/ghc/-/issues/23024nameModule panic with horde-ad2023-04-19T09:42:44ZKrzysztof GogolewskinameModule panic with horde-adCompiling `ghc -O X` causes an assertion failure in `GHC.Iface.Binary.serialiseName`. If assertions are disabled, it causes a panic in `nameModule`. Reproduced on 9.6 and master, with cherry-picked patch !10017.
The testcase is a minimi...Compiling `ghc -O X` causes an assertion failure in `GHC.Iface.Binary.serialiseName`. If assertions are disabled, it causes a panic in `nameModule`. Reproduced on 9.6 and master, with cherry-picked patch !10017.
The testcase is a minimized version of `horde-ad` and its dependencies from https://gitlab.haskell.org/ghc/ghc/-/issues/22955#note_483278. Unfortunately it's rather fragile and requires plenty of type classes, I wasn't able to improve upon that.
```haskell
{-# OPTIONS_GHC -fspecialize-aggressively -fexpose-all-unfoldings #-}
{-# LANGUAGE RankNTypes #-}
module X (testPolyn) where
import Y
testPolyn :: (forall r. Tensor r => r) -> Vector Double
testPolyn f = gradientFromDelta f
```
```haskell
{-# OPTIONS_GHC -fspecialize-aggressively -fexpose-all-unfoldings #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts, UndecidableInstances,
DataKinds, MultiParamTypeClasses, RankNTypes, MonoLocalBinds #-}
module Y where
import System.IO.Unsafe
import Control.Monad.ST ( ST, runST )
import Foreign.ForeignPtr
import Foreign.Storable
import GHC.ForeignPtr ( unsafeWithForeignPtr )
class MyNum a where
fi :: a
class (MyNum a, Eq a) => MyReal a
class (MyReal a) => MyRealFrac a where
fun :: a -> ()
class (MyRealFrac a, MyNum a) => MyRealFloat a
instance MyNum Double
instance MyReal Double
instance MyRealFloat Double
instance MyRealFrac Double
newtype Vector a = Vector (ForeignPtr a)
class GVector v a where
instance Storable a => GVector Vector a
vunstream :: () -> ST s (v a)
vunstream () = vunstream ()
empty :: GVector v a => v a
empty = runST (vunstream ())
{-# NOINLINE empty #-}
instance (Storable a, Eq a) => Eq (Vector a) where
xs == ys = idx xs == idx ys
{-# NOINLINE idx #-}
idx (Vector fp) = unsafePerformIO
$ unsafeWithForeignPtr fp $ \p ->
peekElemOff p 0
instance MyNum (Vector Double)
instance (MyNum (Vector a), Storable a, Eq a) => MyReal (Vector a)
instance (MyNum (Vector a), Storable a, Eq a) => MyRealFrac (Vector a)
instance (MyNum (Vector a), Storable a, MyRealFloat a) => MyRealFloat (Vector a)
newtype ORArray a = A a
instance (Eq a) => Eq (ORArray a) where
A x == A y = x == y
instance (MyNum (Vector a)) => MyNum (ORArray a)
instance (MyNum (Vector a), Storable a, Eq a) => MyReal (ORArray a)
instance (MyRealFrac (Vector a), Storable a, Eq a) => MyRealFrac (ORArray a)
instance (MyRealFloat (Vector a), Storable a, Eq a) => MyRealFloat (ORArray a)
newtype Ast r = AstConst (ORArray r)
instance Eq (Ast a) where
(==) = undefined
instance MyNum (ORArray a) => MyNum (Ast a) where
fi = AstConst fi
instance MyNum (ORArray a) => MyReal (Ast a)
instance MyRealFrac (ORArray a) => MyRealFrac (Ast a) where
{-# INLINE fun #-}
fun x = ()
instance MyRealFloat (ORArray a) => MyRealFloat (Ast a)
class (MyRealFloat a) => Tensor a
instance (MyRealFloat a, MyNum (Vector a), Storable a) => Tensor (Ast a)
gradientFromDelta :: Storable a => Ast a -> Vector a
gradientFromDelta _ = empty
{-# NOINLINE gradientFromDelta #-}
```
```
$ ghc -O X
...
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.7.20230218:
nameModule
internal $s$fMyRealFracORArray_$cp1MyRealFrac_sZI
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Types/Name.hs:329:3 in ghc:GHC.Types.Name
nameModule, called at compiler/GHC/Iface/Binary.hs:312:16 in ghc:GHC.Iface.Binary
```9.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/22662GHC panic with -O -fno-cpr-anal -fno-cse -fno-full-laziness2023-04-18T10:54:25ZMatthew NaylorGHC panic with -O -fno-cpr-anal -fno-cse -fno-full-laziness## Summary
Panic in GHC 9.4.3 when compiling 4-line program with `-O -fno-cpr-anal -fno-cse -fno-full-laziness`. No panic occurs on 9.2.5.
## Steps to reproduce
Put the following code in a file named `Bug.hs`
```
module Bug where
i...## Summary
Panic in GHC 9.4.3 when compiling 4-line program with `-O -fno-cpr-anal -fno-cse -fno-full-laziness`. No panic occurs on 9.2.5.
## Steps to reproduce
Put the following code in a file named `Bug.hs`
```
module Bug where
import Data.Set
foo x = sequence_ [ f y | y <- x ]
where f _ = return (fromList [0])
```
Now, on the command line:
```
$ ghc -O -fno-cpr-anal -fno-cse -fno-full-laziness Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.4.3:
completeCall
conrep_X1
Stop[BoringCtxt] Integer
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Opt/Simplify.hs:1911:9 in ghc:GHC.Core.Opt.Simplify
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
Removing any of the command-line flags seems to cause the panic to disappear.
## Expected behavior
Compile without a panic.
(Why the strange combination of flags? One of our larger source files takes a long time to compile unless cpr-anal is turned off. The other options are there for historic reasons and not really needed, but still I thought I'd report the bug in case in shows up in other ways.)
## Environment
* GHC version used: 9.4.3
Optional:
* Operating System: Linux
* System Architecture: x86_64https://gitlab.haskell.org/ghc/ghc/-/issues/22743Panic with representation polymorphism checking and forall escape2023-04-18T10:43:12ZKrzysztof GogolewskiPanic with representation polymorphism checking and forall escapeThis invalid program causes a crash in `typeKind` during representation polymorphism checking in 9.4 and master:
```haskell
{-# LANGUAGE DataKinds #-}
module M where
import GHC.Exts
f :: forall f g (a :: TYPE (f g)). Int -> a
f = f
x...This invalid program causes a crash in `typeKind` during representation polymorphism checking in 9.4 and master:
```haskell
{-# LANGUAGE DataKinds #-}
module M where
import GHC.Exts
f :: forall f g (a :: TYPE (f g)). Int -> a
f = f
x = f 0
```
GHC 9.2 gives a correct error
```
M.hs:9:1: error:
• Quantified type's kind mentions quantified type variable
type: ‘forall {k} {f :: k -> RuntimeRep} {g :: k}
{a :: TYPE (f g)}.
a’
```https://gitlab.haskell.org/ghc/ghc/-/issues/22417HEAD segfaults on Windows when building large packages (e.g., lsp-types)2023-04-11T08:19:40ZRyan ScottHEAD segfaults on Windows when building large packages (e.g., lsp-types)When using nightly Windows HEAD bindists, I have noticed that it will segfault when building large packages. Unfortunately, I don't know of a minimal way to reproduce the bug other than to build a large Hackage library with `head.hackage...When using nightly Windows HEAD bindists, I have noticed that it will segfault when building large packages. Unfortunately, I don't know of a minimal way to reproduce the bug other than to build a large Hackage library with `head.hackage`. The `lsp-types-1.6.0.0` library provides a good example of this. To reproduce, do the following:
1. Download a nightly [`x86_64-windows-validate`](https://gitlab.haskell.org/ghc/ghc/-/jobs/artifacts/master/download?job=x86_64-windows-validate) bindist. At the time of writing, I am using the one from [here](https://gitlab.haskell.org/ghc/ghc/-/jobs/1221538/artifacts/download), at commit 3c0e379322965aa87b14923f6d8e1ef5cd677925.
2. Using [`head.hackage`](https://gitlab.haskell.org/ghc/head.hackage/), check out the `lsp-types-1.6.0.0` library:
```
./head.hackage/scripts/patch-tool unpack lsp-types-1.6.0.0
```
3. Build `lsp-types-1.6.0.0` using the nightly Windows bindist. It should eventually produce a segfault that looks roughly like this one:
```
$ cabal build lsp-types
<elided>
[45 of 52] Compiling Language.LSP.Types.Registration ( src\Language\LSP\Types\Registration.hs, C:\\Users\winferno\Documents\Hacki
ng\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.5.20221105\lsp-types-1.6.0.0\build\Language\LSP\Types\Registration.o
)
src\Language\LSP\Types\Registration.hs:128:1: error: [GHC-55017]
Illegal type variable name: `'
When splicing a TH declaration
Access violation in generated code when executing data at 0x7ff6992263d9
Attempting to reconstruct a stack trace...
Frame Code address
* 0xe29c6fd9f0 0x7ff6992263d9 C:\Users\winferno\Software\ghc-9.5.20221105\bin\ghc-9.5.20221105.exe+0x50363d9
Error: cabal-3.8.1.0.exe: Failed to build lsp-types-1.6.0.0. The build process
terminated with exit code 11
```
I've also seen the segfault happen without the `Illegal type variable name` part:
```
[45 of 52] Compiling Language.LSP.Types.Registration ( src\Language\LSP\Types\Registration.hs, C:\\Users\winferno\Documents\Hacki
ng\Haskell\staging\dist-newstyle\build\x86_64-windows\ghc-9.5.20221105\lsp-types-1.6.0.0\build\Language\LSP\Types\Registration.o
)
Access violation in generated code when reading 0xffffffffffffffff
Attempting to reconstruct a stack trace...
Frame Code address
* 0xc27adfd970 0x7ff695a5c188 C:\Users\winferno\Software\ghc-9.5.20221105\bin\ghc-9.5.20221105.exe+0x186c188
Error: cabal-3.8.1.0.exe: Failed to build lsp-types-1.6.0.0. The build process
terminated with exit code 11
```
4. Curiously, if you re-run `cabal build lsp-types`, it will be able to compile the module that segfaulted above (`Language.LSP.Types.Registration`), but it will segfault on a later module:
```
$ cabal build lsp-types
<elided>
[47 of 52] Compiling Language.LSP.Types.Initialize ( src\Language\LSP\Types\Initialize.hs, C:\\Users\winferno\Documents\Hacking\H
askell\staging\dist-newstyle\build\x86_64-windows\ghc-9.5.20221105\lsp-types-1.6.0.0\build\Language\LSP\Types\Initialize.o )
Access violation in generated code when executing data at 0x7ef4cc37b0ba
Attempting to reconstruct a stack trace...
Frame Code address
* 0xeb45cfda80 0x7ef4cc37b0ba
Error: cabal-3.8.1.0.exe: Failed to build lsp-types-1.6.0.0. The build process
terminated with exit code 11
```
If I then re-run `cabal build lsp-types` a third time, then compilation will succeed.
On the other hand, if I run `cabal clean` and then run `cabal build lsp-tyes` afresh, then I will reliably reproduce the first segfault at `Language.LSP.Types.Registration` observed above.
As far as I can tell, this only affects HEAD, and not any GHC version from 9.4 or earlier.9.6.1Andreas KlebingerAndreas Klebingerhttps://gitlab.haskell.org/ghc/ghc/-/issues/22798patchRegsOfInstr panic in GHC 9.2.5, 9.4.4 and 9.6.02023-04-11T05:25:00ZBodigrimpatchRegsOfInstr panic in GHC 9.2.5, 9.4.4 and 9.6.0```
$ cabal unpack SHA-1.5.0.0 && cd SHA-1.5.0.0 && cabal build
Building library for SHA-1.5.0.0..
[1 of 1] Compiling Data.Digest.Pure.SHA
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.6.0.20230111:
...```
$ cabal unpack SHA-1.5.0.0 && cd SHA-1.5.0.0 && cabal build
Building library for SHA-1.5.0.0..
[1 of 1] Compiling Data.Digest.Pure.SHA
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.6.0.20230111:
patchRegsOfInstr
missing
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/CmmToAsm/AArch64/Instr.hs:270:10 in ghc:GHC.CmmToAsm.AArch64.Instr
CallStack (from HasCallStack):
panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error
```
## Environment
* GHC version used: 9.2.5, 9.4.4, 9.6.0-alpha1
Optional:
* Operating System: macOS Ventura 13.0.1
* System Architecture: aarch649.6.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/10110Compiling unit fails with Loading temp shared object failed2023-04-05T15:40:47ZPeter Trommlerptrommler@acm.orgCompiling unit fails with Loading temp shared object failed\@goldfire reported in #10058 in comment 1 another failure:
```
[43 of 55] Compiling Tests.Compile.UnitParser ( Tests/Compile/UnitParser.hs, dist/build/main/main-tmp/Tests/Compile/UnitParser.o )
<no location info>:
ghc: panic! (the 'i...\@goldfire reported in #10058 in comment 1 another failure:
```
[43 of 55] Compiling Tests.Compile.UnitParser ( Tests/Compile/UnitParser.hs, dist/build/main/main-tmp/Tests/Compile/UnitParser.o )
<no location info>:
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.0.20150123 for x86_64-unknown-linux):
Loading temp shared object failed: /tmp/ghc6444_0/libghc6444_264.so: undefined symbol: DataziMetrologyziSIziUnits_zdfShowHectare_closure
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
While on the surface this looks like a duplicate of #10058 it is not. The issue is only on Linux (travis to be precise), not OSX. Looking at the undefined symbol, here we see a symbol from the current module whereas in #10058 the undefined symbol lives in one of the packages.
My theory is that the travis machine is running a modified link editor that defaults to `--as-needed` being set whereas the binutils default is `-no-as-needed`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.1-rc2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | hvr |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Compiling unit fails with Loading temp shared object failed","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"7.10.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["hvr"],"type":"Bug","description":"@goldfire reported in #10058 in comment 1 another failure:\r\n{{{\r\n[43 of 55] Compiling Tests.Compile.UnitParser ( Tests/Compile/UnitParser.hs, dist/build/main/main-tmp/Tests/Compile/UnitParser.o )\r\n\r\n<no location info>:\r\n\r\nghc: panic! (the 'impossible' happened)\r\n\r\n(GHC version 7.10.0.20150123 for x86_64-unknown-linux):\r\n\r\nLoading temp shared object failed: /tmp/ghc6444_0/libghc6444_264.so: undefined symbol: DataziMetrologyziSIziUnits_zdfShowHectare_closure\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nWhile on the surface this looks like a duplicate of #10058 it is not. The issue is only on Linux (travis to be precise), not OSX. Looking at the undefined symbol, here we see a symbol from the current module whereas in #10058 the undefined symbol lives in one of the packages.\r\n\r\nMy theory is that the travis machine is running a modified link editor that defaults to `--as-needed` being set whereas the binutils default is `-no-as-needed`.","type_of_failure":"OtherFailure","blocking":[]} -->7.10.2https://gitlab.haskell.org/ghc/ghc/-/issues/13956ghc panic compiling lame-0.1.12023-04-03T11:10:36Zuznxghc panic compiling lame-0.1.1Compiling the package lame-0.1.1 using cabal, with profiling:
```
[2 of 2] Compiling Codec.Audio.LAME ( Codec/Audio/LAME.hs, dist/build/Codec/Audio/LAME.p_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.0.20170704 for x86...Compiling the package lame-0.1.1 using cabal, with profiling:
```
[2 of 2] Compiling Codec.Audio.LAME ( Codec/Audio/LAME.hs, dist/build/Codec/Audio/LAME.p_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.0.20170704 for x86_64-unknown-linux):
Simplifier ticks exhausted
When trying UnfoldingDone lvl_soT9
To increase the limit, use -fsimpl-tick-factor=N (default 100)
If you need to do this, let GHC HQ know, and what factor you needed
To see detailed counts use -ddump-simpl-stats
Total ticks: 504681
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable
pprPanic, called at compiler/simplCore/SimplMonad.hs:199:31 in ghc:SimplMonad
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
This is a regression; the package compiles fine with GHC 8.0.28.2.2https://gitlab.haskell.org/ghc/ghc/-/issues/16095Infinite loop during error reporting (ignores SIGINT/SIGTERM, then OOMs)2023-04-01T11:47:52ZSerge KosyrevInfinite loop during error reporting (ignores SIGINT/SIGTERM, then OOMs)Compiling the repro snippet produces the following incomplete output and hangs GHC:
```
$ ghc repro.hs
[1 of 1] Compiling Main ( repro.hs, repro.o )
repro.hs:16:22: error:
```
The GHC process ignores SIGINT -- so it must b...Compiling the repro snippet produces the following incomplete output and hangs GHC:
```
$ ghc repro.hs
[1 of 1] Compiling Main ( repro.hs, repro.o )
repro.hs:16:22: error:
```
The GHC process ignores SIGINT -- so it must be killed with SIGKILL.
The memory usage grows, until it consumes all memory (\~30G RAM + swap) and is terminated by the OOM killer.
This minimal snippet depends on `generics-sop` (tested with version `0.4.0.0`).
Sadly I didn't find a constraint in `base` to cause this behavior..
```hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
import Generics.SOP (HasDatatypeInfo)
data family TF i a :: *
data instance TF i a = R
class C i a where
method :: TF i a
instance C i () where
instance HasDatatypeInfo a => C i a where
method = undefined function
function :: C i a => TF i a
function = method
main = undefined
```
Affects 8.4.3 and 8.6.1.
Not tested on 8.6.2 & 8.6.3.https://gitlab.haskell.org/ghc/ghc/-/issues/230009.2.6: panic when compiling type-natural-1.1.0.12023-03-15T08:22:04Zsterni9.2.6: panic when compiling type-natural-1.1.0.1## Summary
GHC panics while compiling a profiling object of `type-natural-1.1.0.1`:
```
[ 6 of 10] Compiling Data.Type.Natural.Lemma.Order ( src/Data/Type/Natural/Lemma/Order.hs, dist/build/Data/Type/Natural/Lemma/Order.p_o )
src/Data...## Summary
GHC panics while compiling a profiling object of `type-natural-1.1.0.1`:
```
[ 6 of 10] Compiling Data.Type.Natural.Lemma.Order ( src/Data/Type/Natural/Lemma/Order.hs, dist/build/Data/Type/Natural/Lemma/Order.p_o )
src/Data/Type/Natural/Lemma/Order.hs:155:1: warning: [-Wunused-imports]
The import of ‘Numeric.Natural’ is redundant
except perhaps to import instances from ‘Numeric.Natural’
To import instances alone, use: import Numeric.Natural()
|
155 | import Numeric.Natural (Natural)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.6:
expectOnly: cgLit:Rubbish
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
## Steps to reproduce
* Compile `type-natural-1.1.0.1` using GHC 9.2.6 with library profiling enabled
* Alternatively: checkout `107c04a3cd80bca46e9025d6a8c9d3c210ead575` of nixpkgs and run `nix-build -A haskellPackages.type-natural`
<details>
<summary>full log </summary>
```
configureFlags: --verbose --prefix=/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/5rzvavmxnk1szn2d1f62x4lk917wvnq5-type-natural-1.1.0.1-doc/share/doc/type-natural-1.1.0.1 --with-gcc=gcc --package-db=/build/tmp.tUb59RTnrx/package.conf.d --ghc-options=-j4 +RTS -A64M -RTS --disable-split-objs --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --ghc-options=-haddock --extra-lib-dirs=/nix/store/35s126gfkfrwbiv49kv9kxqdpd9zvcvm-ncurses-6.4/lib --extra-lib-dirs=/nix/store/bmnh7b67zx6l5wi6vgjvsfwrzw7ivfph-libffi-3.4.4/lib --extra-lib-dirs=/nix/store/w3qi8zxj01mn4i92r8asmyljm42ps401-gmp-with-cxx-6.2.1/lib --extra-lib-dirs=/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/lib
Using Parsec parser
Configuring type-natural-1.1.0.1...
Dependency base >=4 && <5: using base-4.16.4.0
Dependency constraints >=0.3: using constraints-0.13.4
Dependency equational-reasoning >=0.4.1.1: using equational-reasoning-0.7.0.1
Dependency ghc: using ghc-9.2.6
Dependency ghc-typelits-knownnat: using ghc-typelits-knownnat-0.7.7
Dependency ghc-typelits-natnormalise >=0.4: using
ghc-typelits-natnormalise-0.7.7
Dependency ghc-typelits-presburger >=0.5.1: using
ghc-typelits-presburger-0.6.2.0
Dependency integer-logarithms: using integer-logarithms-1.0.3.1
Dependency template-haskell >=2.8: using template-haskell-2.18.0.0
Dependency QuickCheck: using QuickCheck-2.14.2
Dependency base: using base-4.16.4.0
Dependency equational-reasoning: using equational-reasoning-0.7.0.1
Dependency integer-logarithms: using integer-logarithms-1.0.3.1
Dependency quickcheck-instances: using quickcheck-instances-0.3.28
Dependency tasty: using tasty-1.4.3
Dependency tasty-discover: using tasty-discover-4.2.2
Dependency tasty-hunit: using tasty-hunit-0.10.0.3
Dependency tasty-quickcheck: using tasty-quickcheck-0.10.2
Dependency template-haskell: using template-haskell-2.18.0.0
Dependency type-natural: using type-natural-1.1.0.1
Source component graph:
component lib
component test:type-natural-test dependency lib
Configured component graph:
component type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
include base-4.16.4.0
include constraints-0.13.4-Ev2HlZTRtn3DbSYmh9cnHY
include equational-reasoning-0.7.0.1-IShDaZne2bs954OCeB4On5
include ghc-9.2.6
include ghc-typelits-knownnat-0.7.7-CHQVSRxxi9g1VkKmxvlbMN
include ghc-typelits-natnormalise-0.7.7-GaCRdSNHVmr5z4fjv4th
include ghc-typelits-presburger-0.6.2.0-BPR6nvEeHXb55wKrnGmn1x
include integer-logarithms-1.0.3.1-HD4Ba46Xh9wIBhXmf2Qwpm
include template-haskell-2.18.0.0
component type-natural-1.1.0.1-Ha8ntknPWIQ8nXv4Mv1hkp-type-natural-test
include QuickCheck-2.14.2-9swKYhr9FC68rr9oJeIYxS
include base-4.16.4.0
include equational-reasoning-0.7.0.1-IShDaZne2bs954OCeB4On5
include integer-logarithms-1.0.3.1-HD4Ba46Xh9wIBhXmf2Qwpm
include quickcheck-instances-0.3.28-Fo0LIbt2gzJ8KzvgUoV0Qz
include tasty-1.4.3-I7UTXXBNQmpBuxsD7iBDf
include tasty-discover-4.2.2-KJvCoJH3cmyBcXXL7ASDgV
include tasty-hunit-0.10.0.3-5gW5br1avVmDRoG1UA3lIa
include tasty-quickcheck-0.10.2-Hc60Fs2w7MeAFcigstw6gD
include template-haskell-2.18.0.0
include type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
Linked component graph:
unit type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
include base-4.16.4.0
include constraints-0.13.4-Ev2HlZTRtn3DbSYmh9cnHY
include equational-reasoning-0.7.0.1-IShDaZne2bs954OCeB4On5
include ghc-9.2.6
include ghc-typelits-knownnat-0.7.7-CHQVSRxxi9g1VkKmxvlbMN
include ghc-typelits-natnormalise-0.7.7-GaCRdSNHVmr5z4fjv4th
include ghc-typelits-presburger-0.6.2.0-BPR6nvEeHXb55wKrnGmn1x
include integer-logarithms-1.0.3.1-HD4Ba46Xh9wIBhXmf2Qwpm
include template-haskell-2.18.0.0
Data.Type.Natural=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Natural,Data.Type.Natural.Builtin=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Natural.Builtin,Data.Type.Natural.Lemma.Arithmetic=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Natural.Lemma.Arithmetic,Data.Type.Natural.Lemma.Order=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Natural.Lemma.Order,Data.Type.Natural.Presburger.MinMaxSolver=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Natural.Presburger.MinMaxSolver,Data.Type.Ordinal=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Ordinal,Data.Type.Ordinal.Builtin=type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD:Data.Type.Ordinal.Builtin
unit type-natural-1.1.0.1-Ha8ntknPWIQ8nXv4Mv1hkp-type-natural-test
include QuickCheck-2.14.2-9swKYhr9FC68rr9oJeIYxS
include base-4.16.4.0
include equational-reasoning-0.7.0.1-IShDaZne2bs954OCeB4On5
include integer-logarithms-1.0.3.1-HD4Ba46Xh9wIBhXmf2Qwpm
include quickcheck-instances-0.3.28-Fo0LIbt2gzJ8KzvgUoV0Qz
include tasty-1.4.3-I7UTXXBNQmpBuxsD7iBDf
include tasty-discover-4.2.2-KJvCoJH3cmyBcXXL7ASDgV
include tasty-hunit-0.10.0.3-5gW5br1avVmDRoG1UA3lIa
include tasty-quickcheck-0.10.2-Hc60Fs2w7MeAFcigstw6gD
include template-haskell-2.18.0.0
include type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
Ready component graph:
definite type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
depends base-4.16.4.0
depends constraints-0.13.4-Ev2HlZTRtn3DbSYmh9cnHY
depends equational-reasoning-0.7.0.1-IShDaZne2bs954OCeB4On5
depends ghc-9.2.6
depends ghc-typelits-knownnat-0.7.7-CHQVSRxxi9g1VkKmxvlbMN
depends ghc-typelits-natnormalise-0.7.7-GaCRdSNHVmr5z4fjv4th
depends ghc-typelits-presburger-0.6.2.0-BPR6nvEeHXb55wKrnGmn1x
depends integer-logarithms-1.0.3.1-HD4Ba46Xh9wIBhXmf2Qwpm
depends template-haskell-2.18.0.0
definite type-natural-1.1.0.1-Ha8ntknPWIQ8nXv4Mv1hkp-type-natural-test
depends QuickCheck-2.14.2-9swKYhr9FC68rr9oJeIYxS
depends base-4.16.4.0
depends equational-reasoning-0.7.0.1-IShDaZne2bs954OCeB4On5
depends integer-logarithms-1.0.3.1-HD4Ba46Xh9wIBhXmf2Qwpm
depends quickcheck-instances-0.3.28-Fo0LIbt2gzJ8KzvgUoV0Qz
depends tasty-1.4.3-I7UTXXBNQmpBuxsD7iBDf
depends tasty-discover-4.2.2-KJvCoJH3cmyBcXXL7ASDgV
depends tasty-hunit-0.10.0.3-5gW5br1avVmDRoG1UA3lIa
depends tasty-quickcheck-0.10.2-Hc60Fs2w7MeAFcigstw6gD
depends template-haskell-2.18.0.0
depends type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
Using Cabal-3.6.3.0 compiled by ghc-9.2
Using compiler: ghc-9.2.6
Using install prefix:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1
Executables installed in:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1/bin
Libraries installed in:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1/lib/ghc-9.2.6/x86_64-linux-ghc-9.2.6/type-natural-1.1.0.1-SEgCR8MpYs49rIBoKC8hD
Dynamic Libraries installed in:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1/lib/ghc-9.2.6/x86_64-linux-ghc-9.2.6
Private executables installed in:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1/libexec/x86_64-linux-ghc-9.2.6/type-natural-1.1.0.1
Data files installed in:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1/share/x86_64-linux-ghc-9.2.6/type-natural-1.1.0.1
Documentation installed in:
/nix/store/5rzvavmxnk1szn2d1f62x4lk917wvnq5-type-natural-1.1.0.1-doc/share/doc/type-natural-1.1.0.1
Configuration files installed in:
/nix/store/kpgqmfzsn5nx08fmh0xbcrfisgrm56hp-type-natural-1.1.0.1/etc
No alex found
Using ar found on system at:
/nix/store/qmmd097h4rwh2pwgz9l9i0byxb0x8q8l-binutils-2.40/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 12.2.0 given by user at:
/nix/store/l0fvy72hpfdpjjs3dk4112f57x7r3dlm-gcc-wrapper-12.2.0/bin/gcc
Using ghc version 9.2.6 found on system at:
/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/bin/ghc
Using ghc-pkg version 9.2.6 found on system at:
/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/bin/ghc-pkg-9.2.6
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.26.0 found on system at:
/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/bin/haddock-ghc-9.2.6
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/bin/hpc
Using hsc2hs version 0.68.8 found on system at:
/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/cs28fbj8zg8f7m49pgi85xan4x6wjyxn-hscolour-1.24.4/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/72nvsslmgq8mp6ywxnl9i0rr8x174sjw-binutils-wrapper-2.40/bin/ld.gold
No pkg-config found
Using runghc version 9.2.6 found on system at:
/nix/store/322zfsd89g1xph46glm0jjvwjkj09mv4-ghc-9.2.6/bin/runghc-9.2.6
Using strip version 2.40 found on system at:
/nix/store/l0fvy72hpfdpjjs3dk4112f57x7r3dlm-gcc-wrapper-12.2.0/bin/strip
Using tar found on system at:
/nix/store/dyyx4hjy9sx92nwwlj4mm334b7dkzj70-gnutar-1.34/bin/tar
No uhc found
building
Preprocessing library for type-natural-1.1.0.1..
Building library for type-natural-1.1.0.1..
[ 1 of 10] Compiling Data.Type.Natural.Presburger.MinMaxSolver ( src/Data/Type/Natural/Presburger/MinMaxSolver.hs, dist/build/Data/Type/Natural/Presburger/MinMaxSolver.o, dist/build/Data/Type/Natural/Presburger/MinMaxSolver.dyn_o )
src/Data/Type/Natural/Presburger/MinMaxSolver.hs:14:1: warning: [-Wunused-imports]
The import of ‘GHC.Plugins’ is redundant
except perhaps to import instances from ‘GHC.Plugins’
To import instances alone, use: import GHC.Plugins()
|
14 | import GHC.Plugins
| ^^^^^^^^^^^^^^^^^^...
src/Data/Type/Natural/Presburger/MinMaxSolver.hs:21:1: warning: [-Wunused-imports]
The import of ‘GHC.Tc.Plugin’ is redundant
except perhaps to import instances from ‘GHC.Tc.Plugin’
To import instances alone, use: import GHC.Tc.Plugin()
|
21 | import GHC.Tc.Plugin
| ^^^^^^^^^^^^^^^^^^^^
[ 2 of 10] Compiling Data.Type.Natural.Utils ( src/Data/Type/Natural/Utils.hs, dist/build/Data/Type/Natural/Utils.o, dist/build/Data/Type/Natural/Utils.dyn_o )
[ 3 of 10] Compiling Data.Type.Natural.Core ( src/Data/Type/Natural/Core.hs, dist/build/Data/Type/Natural/Core.o, dist/build/Data/Type/Natural/Core.dyn_o )
src/Data/Type/Natural/Core.hs:76:1: warning: [-Wunused-imports]
The import of ‘Numeric.Natural’ is redundant
except perhaps to import instances from ‘Numeric.Natural’
To import instances alone, use: import Numeric.Natural()
|
76 | import Numeric.Natural (Natural)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 4 of 10] Compiling Data.Type.Natural.Lemma.Presburger ( src/Data/Type/Natural/Lemma/Presburger.hs, dist/build/Data/Type/Natural/Lemma/Presburger.o, dist/build/Data/Type/Natural/Lemma/Presburger.dyn_o )
src/Data/Type/Natural/Lemma/Presburger.hs:37:1: warning: [-Woverlapping-patterns]
Pattern match has inaccessible right hand side
In an equation for ‘succNonCyclic’:
succNonCyclic (Succ n) Refl = ...
|
37 | succNonCyclic (Succ n) Refl = succNonCyclic n Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/Type/Natural/Lemma/Presburger.hs:37:24: warning: [-Winaccessible-code]
• Could not deduce: 1 ~ 0
from the context: n ~ Succ n1
bound by a pattern with pattern synonym:
Succ :: forall (n :: Natural).
() =>
forall (n1 :: Natural). (n ~ Succ n1) => SNat n1 -> SNat n,
in an equation for ‘succNonCyclic’
at src/Data/Type/Natural/Lemma/Presburger.hs:37:16-21
or from: 0 ~ Succ n
bound by a pattern with constructor:
Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘succNonCyclic’
at src/Data/Type/Natural/Lemma/Presburger.hs:37:24-27
Inaccessible code in
a pattern with constructor: Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘succNonCyclic’
• In the pattern: Refl
In an equation for ‘succNonCyclic’:
succNonCyclic (Succ n) Refl = succNonCyclic n Refl
|
37 | succNonCyclic (Succ n) Refl = succNonCyclic n Refl
| ^^^^
[ 5 of 10] Compiling Data.Type.Natural.Lemma.Arithmetic ( src/Data/Type/Natural/Lemma/Arithmetic.hs, dist/build/Data/Type/Natural/Lemma/Arithmetic.o, dist/build/Data/Type/Natural/Lemma/Arithmetic.dyn_o )
src/Data/Type/Natural/Lemma/Arithmetic.hs:290:1: warning: [-Woverlapping-patterns]
Pattern match has inaccessible right hand side
In an equation for ‘multEqSuccElimL’:
multEqSuccElimL Zero _ l Refl = ...
|
290 | multEqSuccElimL Zero _ l Refl = absurd $ succNonCyclic l Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/Type/Natural/Lemma/Arithmetic.hs:290:26: warning: [-Winaccessible-code]
• Could not deduce: 1 ~ 0
from the context: n ~ 0
bound by a pattern with pattern synonym:
Zero :: forall (n :: Natural). () => (n ~ 0) => SNat n,
in an equation for ‘multEqSuccElimL’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:290:17-20
or from: Succ l ~ (n * m)
bound by a pattern with constructor:
Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimL’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:290:26-29
Inaccessible code in
a pattern with constructor: Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimL’
• In the pattern: Refl
In an equation for ‘multEqSuccElimL’:
multEqSuccElimL Zero _ l Refl = absurd $ succNonCyclic l Refl
|
290 | multEqSuccElimL Zero _ l Refl = absurd $ succNonCyclic l Refl
| ^^^^
src/Data/Type/Natural/Lemma/Arithmetic.hs:294:1: warning: [-Woverlapping-patterns]
Pattern match has inaccessible right hand side
In an equation for ‘multEqSuccElimR’:
multEqSuccElimR _ Zero l Refl = ...
|
294 | multEqSuccElimR _ Zero l Refl = absurd $ succNonCyclic l Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/Type/Natural/Lemma/Arithmetic.hs:294:26: warning: [-Winaccessible-code]
• Could not deduce: 1 ~ 0
from the context: m ~ 0
bound by a pattern with pattern synonym:
Zero :: forall (n :: Natural). () => (n ~ 0) => SNat n,
in an equation for ‘multEqSuccElimR’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:294:19-22
or from: Succ l ~ (n * m)
bound by a pattern with constructor:
Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimR’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:294:26-29
Inaccessible code in
a pattern with constructor: Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimR’
• In the pattern: Refl
In an equation for ‘multEqSuccElimR’:
multEqSuccElimR _ Zero l Refl = absurd $ succNonCyclic l Refl
|
294 | multEqSuccElimR _ Zero l Refl = absurd $ succNonCyclic l Refl
| ^^^^
[ 6 of 10] Compiling Data.Type.Natural.Lemma.Order ( src/Data/Type/Natural/Lemma/Order.hs, dist/build/Data/Type/Natural/Lemma/Order.o, dist/build/Data/Type/Natural/Lemma/Order.dyn_o )
src/Data/Type/Natural/Lemma/Order.hs:155:1: warning: [-Wunused-imports]
The import of ‘Numeric.Natural’ is redundant
except perhaps to import instances from ‘Numeric.Natural’
To import instances alone, use: import Numeric.Natural()
|
155 | import Numeric.Natural (Natural)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 7 of 10] Compiling Data.Type.Natural ( src/Data/Type/Natural.hs, dist/build/Data/Type/Natural.o, dist/build/Data/Type/Natural.dyn_o )
src/Data/Type/Natural.hs:118:1: warning: [-Wunused-imports]
The import of ‘Numeric.Natural’ is redundant
except perhaps to import instances from ‘Numeric.Natural’
To import instances alone, use: import Numeric.Natural()
|
118 | import Numeric.Natural
| ^^^^^^^^^^^^^^^^^^^^^^
[ 8 of 10] Compiling Data.Type.Natural.Builtin ( src/Data/Type/Natural/Builtin.hs, dist/build/Data/Type/Natural/Builtin.o, dist/build/Data/Type/Natural/Builtin.dyn_o )
[ 9 of 10] Compiling Data.Type.Ordinal ( src/Data/Type/Ordinal.hs, dist/build/Data/Type/Ordinal.o, dist/build/Data/Type/Ordinal.dyn_o )
src/Data/Type/Ordinal.hs:67:1: warning: [-Wunused-imports]
The import of ‘Data.Type.Natural.Core’ is redundant
except perhaps to import instances from ‘Data.Type.Natural.Core’
To import instances alone, use: import Data.Type.Natural.Core()
|
67 | import Data.Type.Natural.Core (SNat (..))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[10 of 10] Compiling Data.Type.Ordinal.Builtin ( src/Data/Type/Ordinal/Builtin.hs, dist/build/Data/Type/Ordinal/Builtin.o, dist/build/Data/Type/Ordinal/Builtin.dyn_o )
[ 1 of 10] Compiling Data.Type.Natural.Presburger.MinMaxSolver ( src/Data/Type/Natural/Presburger/MinMaxSolver.hs, dist/build/Data/Type/Natural/Presburger/MinMaxSolver.p_o )
src/Data/Type/Natural/Presburger/MinMaxSolver.hs:14:1: warning: [-Wunused-imports]
The import of ‘GHC.Plugins’ is redundant
except perhaps to import instances from ‘GHC.Plugins’
To import instances alone, use: import GHC.Plugins()
|
14 | import GHC.Plugins
| ^^^^^^^^^^^^^^^^^^...
src/Data/Type/Natural/Presburger/MinMaxSolver.hs:21:1: warning: [-Wunused-imports]
The import of ‘GHC.Tc.Plugin’ is redundant
except perhaps to import instances from ‘GHC.Tc.Plugin’
To import instances alone, use: import GHC.Tc.Plugin()
|
21 | import GHC.Tc.Plugin
| ^^^^^^^^^^^^^^^^^^^^
[ 2 of 10] Compiling Data.Type.Natural.Utils ( src/Data/Type/Natural/Utils.hs, dist/build/Data/Type/Natural/Utils.p_o )
[ 3 of 10] Compiling Data.Type.Natural.Core ( src/Data/Type/Natural/Core.hs, dist/build/Data/Type/Natural/Core.p_o )
src/Data/Type/Natural/Core.hs:76:1: warning: [-Wunused-imports]
The import of ‘Numeric.Natural’ is redundant
except perhaps to import instances from ‘Numeric.Natural’
To import instances alone, use: import Numeric.Natural()
|
76 | import Numeric.Natural (Natural)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 4 of 10] Compiling Data.Type.Natural.Lemma.Presburger ( src/Data/Type/Natural/Lemma/Presburger.hs, dist/build/Data/Type/Natural/Lemma/Presburger.p_o )
src/Data/Type/Natural/Lemma/Presburger.hs:37:1: warning: [-Woverlapping-patterns]
Pattern match has inaccessible right hand side
In an equation for ‘succNonCyclic’:
succNonCyclic (Succ n) Refl = ...
|
37 | succNonCyclic (Succ n) Refl = succNonCyclic n Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/Type/Natural/Lemma/Presburger.hs:37:24: warning: [-Winaccessible-code]
• Could not deduce: 1 ~ 0
from the context: n ~ Succ n1
bound by a pattern with pattern synonym:
Succ :: forall (n :: Natural).
() =>
forall (n1 :: Natural). (n ~ Succ n1) => SNat n1 -> SNat n,
in an equation for ‘succNonCyclic’
at src/Data/Type/Natural/Lemma/Presburger.hs:37:16-21
or from: 0 ~ Succ n
bound by a pattern with constructor:
Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘succNonCyclic’
at src/Data/Type/Natural/Lemma/Presburger.hs:37:24-27
Inaccessible code in
a pattern with constructor: Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘succNonCyclic’
• In the pattern: Refl
In an equation for ‘succNonCyclic’:
succNonCyclic (Succ n) Refl = succNonCyclic n Refl
|
37 | succNonCyclic (Succ n) Refl = succNonCyclic n Refl
| ^^^^
[ 5 of 10] Compiling Data.Type.Natural.Lemma.Arithmetic ( src/Data/Type/Natural/Lemma/Arithmetic.hs, dist/build/Data/Type/Natural/Lemma/Arithmetic.p_o )
src/Data/Type/Natural/Lemma/Arithmetic.hs:290:1: warning: [-Woverlapping-patterns]
Pattern match has inaccessible right hand side
In an equation for ‘multEqSuccElimL’:
multEqSuccElimL Zero _ l Refl = ...
|
290 | multEqSuccElimL Zero _ l Refl = absurd $ succNonCyclic l Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/Type/Natural/Lemma/Arithmetic.hs:290:26: warning: [-Winaccessible-code]
• Could not deduce: 1 ~ 0
from the context: n ~ 0
bound by a pattern with pattern synonym:
Zero :: forall (n :: Natural). () => (n ~ 0) => SNat n,
in an equation for ‘multEqSuccElimL’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:290:17-20
or from: Succ l ~ (n * m)
bound by a pattern with constructor:
Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimL’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:290:26-29
Inaccessible code in
a pattern with constructor: Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimL’
• In the pattern: Refl
In an equation for ‘multEqSuccElimL’:
multEqSuccElimL Zero _ l Refl = absurd $ succNonCyclic l Refl
|
290 | multEqSuccElimL Zero _ l Refl = absurd $ succNonCyclic l Refl
| ^^^^
src/Data/Type/Natural/Lemma/Arithmetic.hs:294:1: warning: [-Woverlapping-patterns]
Pattern match has inaccessible right hand side
In an equation for ‘multEqSuccElimR’:
multEqSuccElimR _ Zero l Refl = ...
|
294 | multEqSuccElimR _ Zero l Refl = absurd $ succNonCyclic l Refl
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/Type/Natural/Lemma/Arithmetic.hs:294:26: warning: [-Winaccessible-code]
• Could not deduce: 1 ~ 0
from the context: m ~ 0
bound by a pattern with pattern synonym:
Zero :: forall (n :: Natural). () => (n ~ 0) => SNat n,
in an equation for ‘multEqSuccElimR’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:294:19-22
or from: Succ l ~ (n * m)
bound by a pattern with constructor:
Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimR’
at src/Data/Type/Natural/Lemma/Arithmetic.hs:294:26-29
Inaccessible code in
a pattern with constructor: Refl :: forall {k} (a :: k). a :~: a,
in an equation for ‘multEqSuccElimR’
• In the pattern: Refl
In an equation for ‘multEqSuccElimR’:
multEqSuccElimR _ Zero l Refl = absurd $ succNonCyclic l Refl
|
294 | multEqSuccElimR _ Zero l Refl = absurd $ succNonCyclic l Refl
| ^^^^
[ 6 of 10] Compiling Data.Type.Natural.Lemma.Order ( src/Data/Type/Natural/Lemma/Order.hs, dist/build/Data/Type/Natural/Lemma/Order.p_o )
src/Data/Type/Natural/Lemma/Order.hs:155:1: warning: [-Wunused-imports]
The import of ‘Numeric.Natural’ is redundant
except perhaps to import instances from ‘Numeric.Natural’
To import instances alone, use: import Numeric.Natural()
|
155 | import Numeric.Natural (Natural)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.6:
expectOnly: cgLit:Rubbish
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
</details>
## Expected behavior
It compiles fine
## Environment
* GHC version used: 9.2.6
Optional:
* Operating System: NixOS
* System Architecture: x86_64-linuxZubinZubinhttps://gitlab.haskell.org/ghc/ghc/-/issues/22997GHC HEAD panics in add_demands2023-03-10T16:39:17ZAndreas KlebingerGHC HEAD panics in add_demandsTest case:
```
{-# OPAQUE nexti #-}
nexti :: Int -> Int
nexti x = succ x
```
This is on a branch which includes commit https://gitlab.haskell.org/ghc/ghc/-/commit/b3be0d185b6e597fa517859430cf6d54df04ca46
This is the last output by -dv...Test case:
```
{-# OPAQUE nexti #-}
nexti :: Int -> Int
nexti x = succ x
```
This is on a branch which includes commit https://gitlab.haskell.org/ghc/ghc/-/commit/b3be0d185b6e597fa517859430cf6d54df04ca46
This is the last output by -dverbose-core2core before the panic:
```
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
nexti [InlPrag=OPAQUE] :: Int -> Int
[LclIdX,
Arity=1,
Unf=Unf{Src=<vanilla>, TopLvl=True,
Value=True, ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)}]
nexti = GHC.Enum.$fEnumInt_$csucc
```
Reminiscent of https://gitlab.haskell.org/ghc/ghc/-/commit/f5fd4db6c4adf94fde810074f0b4917d4716b6f9 but this time without involving any casts.
@sgraf812 @simonpj Let me know if you want to pick this up. If not I will likely do so.9.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/22793Type checker crash with some polykinded junk2023-03-04T07:32:24ZDavid FeuerType checker crash with some polykinded junk## Summary
I was doing something kind of impractical with quantified constraints
and such, and crashed the type checker. Fortunately (?) I was able to
reproduce the crash with a greatly stripped down example.
## Steps to reproduce
```...## Summary
I was doing something kind of impractical with quantified constraints
and such, and crashed the type checker. Fortunately (?) I was able to
reproduce the crash with a greatly stripped down example.
## Steps to reproduce
```haskell
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Buggle where
import Data.Kind
type Foo :: forall k. k -> k -> Constraint
class Foo s a
bob :: forall {k1} {ks} {ka} q (p :: k1 -> q -> Type) (f :: ka -> q) (s :: ks) (t :: ks) (a :: ka) (b :: ka). Foo s a => p a (f b) -> p s (f t)
bob f = undefined
```
When I compile this, I see no error messages, but also no compilation products. `-ddump-tc-trace` includes a bunch of call stacks for whatever reason. The first to come up:
```
newNoTcEvBinds unique = axp
attemptM recovering with insoluble constraints
WC {wc_impl =
Implic {
TcLevel = 1
Skolems =
Given-eqs = NoGivenEqs
Status = Unsolved
Given =
Wanted =
WC {wc_impl =
Implic {
TcLevel = 1
Skolems =
Given-eqs = NoGivenEqs
Status = Unsolved
Given =
Wanted =
WC {wc_impl =
Implic {
TcLevel = 2
Skolems = k1_auh[sk:2]
ks_aui[sk:2]
ka_auj[sk:2]
q_auk[sk:2]
(p_aul[sk:2] :: k1_auh[sk:2] -> q_auk[sk:2] -> *)
(f_aum[sk:2] :: ka_auj[sk:2] -> q_auk[sk:2])
(s_aun[sk:2] :: ks_aui[sk:2])
(t_auo[sk:2] :: ks_aui[sk:2])
(a_aup[sk:2] :: ka_auj[sk:2])
(b_auq[sk:2] :: ka_auj[sk:2])
Given-eqs = NoGivenEqs
Status = Unsolved
Given =
Wanted =
WC {wc_simple =
[W] hole{co_avp} {1;{{co_ave}}}:: ks_aui[sk:2]
GHC.Prim.~# k1_auh[sk:2] (CNonCanonical)
[W] hole{co_avt} {1;{{co_avp}}}:: ka_auj[sk:2]
GHC.Prim.~# k1_auh[sk:2] (CNonCanonical)}
Binds = CoEvBindsVar<avn>
an explicit forall {k1_auh} {ks_aui} {ka_auj} q_auk
(p_aul :: k1_auh -> q_auk -> Type)
(f_aum :: ka_auj -> q_auk) (s_aun :: ks_aui)
(t_auo :: ks_aui) (a_aup :: ka_auj)
(b_auq :: ka_auj) }}
Binds = CoEvBindsVar<axn>
the type signature for ‘bob’ }}
Binds = CoEvBindsVar<axp>
UnkSkol (please report this as a bug)
Call stack:
CallStack (from HasCallStack):
unkSkolAnon, called at compiler/GHC/Tc/Solver.hs:231:57 in ghc:GHC.Tc.Solver }}
```
## Expected behavior
I expect compilation to either succeed or produce an error message.
## Environment
* GHC version used: 9.4.4
Optional:
* Operating System:
* System Architecture:https://gitlab.haskell.org/ghc/ghc/-/issues/23023Assertion failure with TypeData + dataToTag#2023-03-04T00:05:44ZRyan ScottAssertion failure with TypeData + dataToTag#_(Originally spun off from https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9960#note_481426)_
If you compile the following program with GHC 9.6 when built with assertions enabled + `-O`:
```hs
{-# LANGUAGE TypeData, MagicHash #-}
m..._(Originally spun off from https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9960#note_481426)_
If you compile the following program with GHC 9.6 when built with assertions enabled + `-O`:
```hs
{-# LANGUAGE TypeData, MagicHash #-}
module B where
import GHC.Exts
type data T a b where
MkT :: T a a
f :: T Int Bool -> Char
f x = case dataToTag# x of
0# -> 'a'
_ -> 'b'
```
Then it will trigger an assertion failure:
```
$ ~/Software/ghc3/_build/stage1/bin/ghc -O Bug.hs
[1 of 1] Compiling B ( Bug.hs, Bug.o )
<no location info>: error:
ASSERT failed!
CallStack (from HasCallStack):
assert, called at compiler/GHC/Core/DataCon.hs:1677:23 in ghc:GHC.Core.DataCon
```
The problem is the transformation:
```
Note [caseRules for dataToTag]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See also Note [dataToTag# magic].
We want to transform
case dataToTag x of
DEFAULT -> e1
1# -> e2
into
case x of
DEFAULT -> e1
(:) _ _ -> e2
```
which can be disabled with:
```diff
diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs
index 7ace3124e9..ebf038c05c 100644
--- a/compiler/GHC/Core/Opt/ConstantFold.hs
+++ b/compiler/GHC/Core/Opt/ConstantFold.hs
@@ -55,7 +55,7 @@ import GHC.Core.TyCo.Compare( eqType )
import GHC.Core.TyCon
( tyConDataCons_maybe, isAlgTyCon, isEnumerationTyCon
, isNewTyCon, tyConDataCons
- , tyConFamilySize )
+ , tyConFamilySize, isTypeDataTyCon )
import GHC.Core.Map.Expr ( eqCoreExpr )
import GHC.Builtin.PrimOps ( PrimOp(..), tagToEnumKey )
@@ -3188,6 +3188,7 @@ caseRules _ (App (App (Var f) (Type ty)) v) -- dataToTag x
| Just DataToTagOp <- isPrimOpId_maybe f
, Just (tc, _) <- tcSplitTyConApp_maybe ty
, isAlgTyCon tc
+ , not (isTypeDataTyCon tc)
= Just (v, tx_con_dtt ty
, \v -> App (App (Var f) (Type ty)) (Var v))
```Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/23022Assertion failure with TypeData + GADTs2023-03-04T00:05:44ZRyan ScottAssertion failure with TypeData + GADTs_(Originally spun off from https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9960#note_481419)_
If you compile the following program with GHC 9.6 when built with assertions enabled + `-O`:
```hs
{-# LANGUAGE TypeData #-}
module B whe..._(Originally spun off from https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9960#note_481419)_
If you compile the following program with GHC 9.6 when built with assertions enabled + `-O`:
```hs
{-# LANGUAGE TypeData #-}
module B where
type data T a b where
MkT :: T a a
f :: T a b -> T a b
f x = x
```
Then it will trigger an assertion failure:
```
$ ~/Software/ghc3/_build/stage1/bin/ghc -O Bug.hs
[1 of 1] Compiling B ( Bug.hs, Bug.o ) [Source file changed]
<no location info>: error:
ASSERT failed!
CallStack (from HasCallStack):
assert, called at compiler/GHC/Core/DataCon.hs:1677:23 in ghc:GHC.Core.DataCon
```
This assertion comes from [here](https://gitlab.haskell.org/ghc/ghc/-/blob/f70a0239490ebea25e50c61c01f945d8df41e92f/compiler/GHC/Core/DataCon.hs#L1671-1678):
```hs
dataConRepArgTys :: DataCon -> [Scaled Type]
dataConRepArgTys (MkData { dcRep = rep
, dcEqSpec = eq_spec
, dcOtherTheta = theta
, dcOrigArgTys = orig_arg_tys })
= case rep of
NoDataConRep -> assert (null eq_spec) $ map unrestricted theta ++ orig_arg_tys
DCR { dcr_arg_tys = arg_tys } -> arg_tys
```Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/23026Assertion failure - InScope - something to do with withDict2023-03-03T08:23:35ZMatthew PickeringAssertion failure - InScope - something to do with withDict```haskell
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVaria...```haskell
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
module Exinst.Internal
where
import Data.Kind (Type)
import GHC.Exts (withDict)
--import Data.Singletons
type family Sing :: k -> Type
class SingI a where
-- | Produce the singleton explicitly. You will likely need the @ScopedTypeVariables@
-- extension to use this method the way you want.
sing :: Sing a
withSingI :: Sing n -> (SingI n => r) -> r
withSingI sn r =
case singInstance sn of
SingInstance -> r
singInstance :: forall k (a :: k). Sing a -> SingInstance a
singInstance s = with_sing_i SingInstance
where
with_sing_i :: (SingI a => SingInstance a) -> SingInstance a
with_sing_i = withDict @(SingI a) @(Sing a) s
data SingInstance (a :: k) where
SingInstance :: SingI a => SingInstance a
--------------------------------------------------------------------------------
data Some4 (f4 :: k4 -> k3 -> k2 -> k1 -> Type) = forall a4 a3 a2 a1.
Some4 !(Sing a4) !(Sing a3) !(Sing a2) !(Sing a1) !(f4 a4 a3 a2 a1)
--------------------------------------------------------------------------------
-- | Like 'withSome4', but takes explicit 'Sing's besides the 'SingI' instances.
withSome4Sing
:: forall k4 k3 k2 k1 (f4 :: k4 -> k3 -> k2 -> k1 -> Type) (r :: Type)
. Some4 f4
-> (forall a4 a3 a2 a1
. (SingI a4, SingI a3, SingI a2, SingI a1)
=> Sing a4 -> Sing a3 -> Sing a2 -> Sing a1 -> f4 a4 a3 a2 a1 -> r)
-> r -- ^
withSome4Sing (Some4 sa4 sa3 sa2 sa1 x) g =
withSingI sa4 (withSingI sa3 (withSingI sa2 (withSingI sa1
(g sa4 sa3 sa2 sa1 x))))
{-# INLINABLE withSome4Sing #-}
```
```
[nix-shell:~/head.hackage/packages/exinst-0.9]$ /home/matt/head.hackage/ghc/bin/ghc Internal.hs -fforce-recomp -O
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.6.0.20230220:
ASSERT failed!
in_scope InScope {a4_ayI g_sKb}
tenv [ayI :-> a4_ayI]
cenv []
tys [k3_sJU]
cos []
needInScope {k3_sJU}
Call stack:
CallStack (from HasCallStack):
assertPpr, called at compiler/GHC/Core/TyCo/Subst.hs:695:5 in ghc:GHC.Core.TyCo.Subst
checkValidSubst, called at compiler/GHC/Core/TyCo/Subst.hs:719:29 in ghc:GHC.Core.TyCo.Subst
substTy, called at compiler/GHC/Core/TyCo/Subst.hs:1017:34 in ghc:GHC.Core.TyCo.Subst
substVarBndr, called at compiler/GHC/Core/Opt/Arity.hs:3104:29 in ghc:GHC.Core.Opt.Arity
CallStack (from HasCallStack):
panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```9.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/22849GHC 9.6 panics about kindPrimRep2023-02-20T09:50:59ZBodigrimGHC 9.6 panics about kindPrimRep## Summary
GHC 9.6.0.20230111 (alpha 1) fails with `kindPrimRep` panic.
## Steps to reproduce
Save this as `Foo.hs`:
```haskell
{-# LANGUAGE GADTs #-}
{-# OPTIONS_GHC -O #-}
module Lib where
data Foo a where
Foo :: Foo Int
data ...## Summary
GHC 9.6.0.20230111 (alpha 1) fails with `kindPrimRep` panic.
## Steps to reproduce
Save this as `Foo.hs`:
```haskell
{-# LANGUAGE GADTs #-}
{-# OPTIONS_GHC -O #-}
module Lib where
data Foo a where
Foo :: Foo Int
data Bar a = Bar a (Foo a)
data Some t = forall ix. Some (t ix)
instance Show (Some Bar) where
show (Some (Bar v t)) = case t of
Foo -> show v
```
Run
```sh
$ ghc-9.4 Foo.hs
[1 of 1] Compiling Lib ( Foo.hs, Foo.o )
$ ghc-9.6 Foo.hs
[1 of 1] Compiling Lib ( Foo.hs, Foo.o )
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.6.0.20230111:
kindPrimRep
k_aDP
typePrimRep (ix_aDW :: k_aDP)
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Types/RepType.hs:588:5 in ghc:GHC.Types.RepType
CallStack (from HasCallStack):
panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error
```
## Expected behavior
I'd expect GHC 9.6 to succeed, similar to GHC 9.4.
## Environment
* GHC version used: GHC 9.6.0.20230111 (alpha 1)9.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/22491refineFromInScope panic with -O2 on GHC 9.2.5/9.4.3 (but not on 9.2.4/9.4.2)2023-02-14T18:47:37ZRyan ScottrefineFromInScope panic with -O2 on GHC 9.2.5/9.4.3 (but not on 9.2.4/9.4.2)The [`saw-script`](https://github.com/GaloisInc/saw-script/) repository panics when built with GHC 9.2.5, but not with GHC 9.2.4. Here is a somewhat minimal reproducer with no external dependencies:
<details>
```hs
{-# LANGUAGE Haskell...The [`saw-script`](https://github.com/GaloisInc/saw-script/) repository panics when built with GHC 9.2.5, but not with GHC 9.2.4. Here is a somewhat minimal reproducer with no external dependencies:
<details>
```hs
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module SAWScript.HeapsterBuiltins (heapster_add_block_hints) where
import qualified Control.Exception as X
import Control.Applicative
import Control.Monad
import Control.Monad.Catch (MonadThrow(..), MonadCatch(..), catches, Handler(..))
import Control.Monad.IO.Class
import qualified Control.Monad.Fail as Fail
import Control.Monad.Trans.Class (MonadTrans(..))
import Control.Monad.Trans.Reader (ReaderT)
import Data.Coerce (Coercible, coerce)
import Data.IORef
import Data.Kind (Type)
import Data.Monoid
import GHC.Exts (build)
failOnNothing :: Fail.MonadFail m => String -> Maybe a -> m a
failOnNothing err_str Nothing = Fail.fail err_str
failOnNothing _ (Just a) = return a
lookupLLVMSymbolModAndCFG :: HeapsterEnv -> String -> IO (Maybe (AnyCFG LLVM))
lookupLLVMSymbolModAndCFG _ _ = pure Nothing
heapster_add_block_hints :: HeapsterEnv -> String -> [Int] ->
(forall ext blocks ret.
CFG ext blocks ret ->
TopLevel Hint) ->
TopLevel ()
heapster_add_block_hints henv nm blks hintF =
do env <- liftIO $ readIORef $ heapsterEnvPermEnvRef henv
AnyCFG cfg <-
failOnNothing ("Could not find symbol definition: " ++ nm) =<<
io (lookupLLVMSymbolModAndCFG henv nm)
let blocks = fmapFC blockInputs $ cfgBlockMap cfg
block_idxs = fmapFC (blockIDIndex . blockID) $ cfgBlockMap cfg
blkIDs <- case blks of
[] -> pure $ toListFC (Some . BlockID) block_idxs
_ -> forM blks $ \blk ->
failOnNothing ("Block ID " ++ show blk ++
" not found in function " ++ nm)
(fmapF BlockID <$> intIndex blk (size blocks))
env' <- foldM (\env' _ ->
permEnvAddHint env' <$>
hintF cfg)
env blkIDs
liftIO $ writeIORef (heapsterEnvPermEnvRef henv) env'
-----
data Some (f:: k -> Type) = forall x . Some (f x)
class FunctorF m where
fmapF :: (forall x . f x -> g x) -> m f -> m g
mapSome :: (forall tp . f tp -> g tp) -> Some f -> Some g
mapSome f (Some x) = Some $! f x
instance FunctorF Some where fmapF = mapSome
type SingleCtx x = EmptyCtx ::> x
data Ctx k
= EmptyCtx
| Ctx k ::> k
type family (<+>) (x :: Ctx k) (y :: Ctx k) :: Ctx k where
x <+> EmptyCtx = x
x <+> (y ::> e) = (x <+> y) ::> e
data Height = Zero | Succ Height
data BalancedTree h (f :: k -> Type) (p :: Ctx k) where
BalLeaf :: !(f x) -> BalancedTree 'Zero f (SingleCtx x)
BalPair :: !(BalancedTree h f x)
-> !(BalancedTree h f y)
-> BalancedTree ('Succ h) f (x <+> y)
data BinomialTree (h::Height) (f :: k -> Type) :: Ctx k -> Type where
Empty :: BinomialTree h f EmptyCtx
PlusOne :: !Int
-> !(BinomialTree ('Succ h) f x)
-> !(BalancedTree h f y)
-> BinomialTree h f (x <+> y)
PlusZero :: !Int
-> !(BinomialTree ('Succ h) f x)
-> BinomialTree h f x
tsize :: BinomialTree h f a -> Int
tsize Empty = 0
tsize (PlusOne s _ _) = 2*s+1
tsize (PlusZero s _) = 2*s
fmap_bin :: (forall tp . f tp -> g tp)
-> BinomialTree h f c
-> BinomialTree h g c
fmap_bin _ Empty = Empty
fmap_bin f (PlusOne s t x) = PlusOne s (fmap_bin f t) (fmap_bal f x)
fmap_bin f (PlusZero s t) = PlusZero s (fmap_bin f t)
{-# INLINABLE fmap_bin #-}
fmap_bal :: (forall tp . f tp -> g tp)
-> BalancedTree h f c
-> BalancedTree h g c
fmap_bal = go
where go :: (forall tp . f tp -> g tp)
-> BalancedTree h f c
-> BalancedTree h g c
go f (BalLeaf x) = BalLeaf (f x)
go f (BalPair x y) = BalPair (go f x) (go f y)
{-# INLINABLE fmap_bal #-}
traverse_bin :: Applicative m
=> (forall tp . f tp -> m (g tp))
-> BinomialTree h f c
-> m (BinomialTree h g c)
traverse_bin _ Empty = pure Empty
traverse_bin f (PlusOne s t x) = PlusOne s <$> traverse_bin f t <*> traverse_bal f x
traverse_bin f (PlusZero s t) = PlusZero s <$> traverse_bin f t
{-# INLINABLE traverse_bin #-}
traverse_bal :: Applicative m
=> (forall tp . f tp -> m (g tp))
-> BalancedTree h f c
-> m (BalancedTree h g c)
traverse_bal = go
where go :: Applicative m
=> (forall tp . f tp -> m (g tp))
-> BalancedTree h f c
-> m (BalancedTree h g c)
go f (BalLeaf x) = BalLeaf <$> f x
go f (BalPair x y) = BalPair <$> go f x <*> go f y
{-# INLINABLE traverse_bal #-}
data Assignment (f :: k -> Type) (ctx :: Ctx k)
= Assignment (BinomialTree 'Zero f ctx)
newtype Index (ctx :: Ctx k) (tp :: k) = Index { indexVal :: Int }
newtype Size (ctx :: Ctx k) = Size Int
intIndex :: Int -> Size ctx -> Maybe (Some (Index ctx))
intIndex i n | 0 <= i && i < sizeInt n = Just (Some (Index i))
| otherwise = Nothing
size :: Assignment f ctx -> Size ctx
size (Assignment t) = Size (tsize t)
sizeInt :: Size ctx -> Int
sizeInt (Size n) = n
class FunctorFC (t :: (k -> Type) -> l -> Type) where
fmapFC :: forall f g. (forall x. f x -> g x) ->
(forall x. t f x -> t g x)
(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
(#.) _f = coerce
class FoldableFC (t :: (k -> Type) -> l -> Type) where
foldMapFC :: forall f m. Monoid m => (forall x. f x -> m) -> (forall x. t f x -> m)
foldMapFC f = foldrFC (mappend . f) mempty
foldrFC :: forall f b. (forall x. f x -> b -> b) -> (forall x. b -> t f x -> b)
foldrFC f z t = appEndo (foldMapFC (Endo #. f) t) z
toListFC :: forall f a. (forall x. f x -> a) -> (forall x. t f x -> [a])
toListFC f t = build (\c n -> foldrFC (\e v -> c (f e) v) n t)
foldMapFCDefault :: (TraversableFC t, Monoid m) => (forall x. f x -> m) -> (forall x. t f x -> m)
foldMapFCDefault = \f -> getConst . traverseFC (Const . f)
{-# INLINE foldMapFCDefault #-}
class (FunctorFC t, FoldableFC t) => TraversableFC (t :: (k -> Type) -> l -> Type) where
traverseFC :: forall f g m. Applicative m
=> (forall x. f x -> m (g x))
-> (forall x. t f x -> m (t g x))
instance FunctorFC Assignment where
fmapFC = \f (Assignment x) -> Assignment (fmap_bin f x)
{-# INLINE fmapFC #-}
instance FoldableFC Assignment where
foldMapFC = foldMapFCDefault
{-# INLINE foldMapFC #-}
instance TraversableFC Assignment where
traverseFC = \f (Assignment x) -> Assignment <$> traverse_bin f x
{-# INLINE traverseFC #-}
data CrucibleType
data TypeRepr (tp::CrucibleType) where
type CtxRepr = Assignment TypeRepr
data CFG (ext :: Type)
(blocks :: Ctx (Ctx CrucibleType))
(ret :: CrucibleType)
= CFG { cfgBlockMap :: !(BlockMap ext blocks ret)
}
type BlockMap ext blocks ret = Assignment (Block ext blocks ret) blocks
data Block ext (blocks :: Ctx (Ctx CrucibleType)) (ret :: CrucibleType) ctx
= Block { blockID :: !(BlockID blocks ctx)
, blockInputs :: !(CtxRepr ctx)
}
newtype BlockID (blocks :: Ctx (Ctx CrucibleType)) (tp :: Ctx CrucibleType)
= BlockID { blockIDIndex :: Index blocks tp }
data LLVM
data AnyCFG ext where
AnyCFG :: CFG ext blocks ret
-> AnyCFG ext
newtype StateContT s r m a
= StateContT { runStateContT :: (a -> s -> m r)
-> s
-> m r
}
fmapStateContT :: (a -> b) -> StateContT s r m a -> StateContT s r m b
fmapStateContT = \f m -> StateContT $ \c -> runStateContT m (\v s -> (c $! f v) s)
{-# INLINE fmapStateContT #-}
applyStateContT :: StateContT s r m (a -> b) -> StateContT s r m a -> StateContT s r m b
applyStateContT = \mf mv ->
StateContT $ \c ->
runStateContT mf (\f -> runStateContT mv (\v s -> (c $! f v) s))
{-# INLINE applyStateContT #-}
returnStateContT :: a -> StateContT s r m a
returnStateContT = \v -> seq v $ StateContT $ \c -> c v
{-# INLINE returnStateContT #-}
bindStateContT :: StateContT s r m a -> (a -> StateContT s r m b) -> StateContT s r m b
bindStateContT = \m n -> StateContT $ \c -> runStateContT m (\a -> runStateContT (n a) c)
{-# INLINE bindStateContT #-}
instance Functor (StateContT s r m) where
fmap = fmapStateContT
instance Applicative (StateContT s r m) where
pure = returnStateContT
(<*>) = applyStateContT
instance Monad (StateContT s r m) where
(>>=) = bindStateContT
instance MonadFail m => MonadFail (StateContT s r m) where
fail = \msg -> StateContT $ \_ _ -> fail msg
instance MonadTrans (StateContT s r) where
lift = \m -> StateContT $ \c s -> m >>= \v -> seq v (c v s)
instance MonadIO m => MonadIO (StateContT s r m) where
liftIO = lift . liftIO
instance MonadThrow m => MonadThrow (StateContT s r m) where
throwM e = StateContT (\_k _s -> throwM e)
instance MonadCatch m => MonadCatch (StateContT s r m) where
catch m hdl =
StateContT $ \k s ->
catch
(runStateContT m k s)
(\e -> runStateContT (hdl e) k s)
data TopLevelRO
data TopLevelRW
data Value
newtype TopLevel a =
TopLevel_ (ReaderT TopLevelRO (StateContT TopLevelRW (Value, TopLevelRW) IO) a)
deriving (Applicative, Functor, Monad, MonadFail, MonadThrow, MonadCatch)
instance MonadIO TopLevel where
liftIO = io
io :: IO a -> TopLevel a
io f = TopLevel_ (liftIO f) `catches` [Handler handleIO]
where
rethrow :: X.Exception ex => ex -> TopLevel a
rethrow ex = throwM (X.SomeException ex)
handleIO :: X.IOException -> TopLevel a
handleIO = rethrow
data HeapsterEnv = HeapsterEnv {
heapsterEnvPermEnvRef :: IORef PermEnv
}
data Hint where
data PermEnv = PermEnv {
permEnvHints :: [Hint]
}
permEnvAddHint :: PermEnv -> Hint -> PermEnv
permEnvAddHint env hint = env { permEnvHints = hint : permEnvHints env }
type family CtxToRList (ctx :: Ctx k) :: RList k where
CtxToRList EmptyCtx = RNil
CtxToRList (ctx' ::> x) = CtxToRList ctx' :> x
data RList a
= RNil
| (RList a) :> a
```
</details>
This will panic when built with `-O2` using GHC 9.2.5 or 9.4.3:
<details>
```
$ ghc-9.2.5 Bug.hs -O2 -fforce-recomp
[1 of 1] Compiling SAWScript.HeapsterBuiltins ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 9.2.5:
refineFromInScope
InScope {wild_00 eta_B0 eta_B1 eta_B2 eta_B3 eta_X3 eta_X4 eta_Xb
eta_Xc eta_Xd a_Xk eta_Xl eta_Xm wild_Xo v_Xp exit_Xr a_Xs eta_Xt
a_a128 henv_a129 nm_a12a blks_a12b hintF_a12c a_a1tQ
$cp1MonadCatch_a345 $cliftIO_a35g $c>>_a36S $cfoldrFC_a3a4
$ctoListFC_a3ap $cfmapF_a3ba $krep_a5fW $krep_a5fY $krep_a5fZ
$krep_a5g0 $krep_a5g1 $krep_a5g2 $krep_a5g3 $krep_a5g4 $krep_a5g5
$krep_a5g6 $krep_a5g7 $krep_a5g8 $krep_a5g9 $krep_a5ga $krep_a5gb
$krep_a5gc $krep_a5gd $krep_a5ge $krep_a5gf $krep_a5gg $krep_a5gh
$krep_a5gi $krep_a5gj $krep_a5gk $krep_a5gl $krep_a5gm $krep_a5go
$krep_a5gq $krep_a5gr $krep_a5gs $krep_a5gt $krep_a5gu $krep_a5gv
$krep_a5gy $krep_a5gz $krep_a5gA $krep_a5gB $krep_a5gC $krep_a5gD
$krep_a5gE $krep_a5gF $krep_a5gG $krep_a5gH $krep_a5gI $krep_a5gJ
$krep_a5gK $krep_a5gL $krep_a5gM $krep_a5gN $krep_a5gP $krep_a5gQ
$krep_a5gR $krep_a5gS $krep_a5gT $krep_a5gU $krep_a5gW $krep_a5gX
$krep_a5gY $krep_a5gZ $krep_a5h1 $krep_a5h2 $krep_a5h3 $krep_a5h4
$krep_a5h5 $krep_a5h6 $krep_a5h7 $krep_a5h8 $krep_a5h9 $krep_a5ha
$krep_a5hc $krep_a5hd $krep_a5he $krep_a5hf $krep_a5hg $krep_a5hh
$krep_a5hi $krep_a5hl $krep_a5hm $krep_a5hn $krep_a5ho $krep_a5hr
$krep_a5hs $krep_a5ht $krep_a5hu $krep_a5hv $krep_a5hx $krep_a5hy
$krep_a5hz $krep_a5hA $krep_a5hB $krep_a5hC $krep_a5hD $krep_a5hE
$krep_a5hF $krep_a5hG $krep_a5hH $krep_a5hI r1_a5BO e1_a5E3
eta1_a5E4 permEnvHints heapsterEnvPermEnvRef runStateContT
blockIDIndex blockID blockInputs cfgBlockMap indexVal
heapster_add_block_hints fmap_bin fmap_bal traverse_bin
traverse_bal $tc'Some $tcSome $tcFunctorF $fFunctorFkSome
$tc'EmptyCtx $tc'::> $tcCtx $tc'Zero $tc'Succ $tcHeight $tc'BalLeaf
$tcBalancedTree $tc'Empty $tc'PlusZero $tcBinomialTree
$tc'Assignment $tcAssignment $tc'Index $tcIndex $tc'Size $tcSize
$tcFunctorFC $fFunctorFCkCtxAssignment $tcFoldableFC $dmfoldMapFC
$dmfoldrFC $dmtoListFC $fFoldableFCkCtxAssignment $tcTraversableFC
$fTraversableFCkCtxAssignment $tcCrucibleType $tcTypeRepr
$tc'BlockID $tcBlockID $tc'Block $tcBlock $tc'CFG $tcCFG $tcLLVM
$tc'AnyCFG $tcAnyCFG $tc'StateContT $tcStateContT
$fMonadCatchStateContT $fMonadThrowStateContT $fMonadIOStateContT
$fMonadTransStateContT $fMonadFailStateContT $fMonadStateContT
$fApplicativeStateContT $fFunctorStateContT $tcTopLevelRO
$tcTopLevelRW $tcValue $tc'TopLevel_ $tcTopLevel $fMonadIOTopLevel
$tcHint $tc'PermEnv $tcPermEnv $tc'HeapsterEnv $tcHeapsterEnv
$tc'RNil $tc':> $tcRList $fApplicativeTopLevel $fFunctorTopLevel
$fMonadTopLevel $fMonadFailTopLevel $fMonadThrowTopLevel
$fMonadCatchTopLevel $trModule $clift_s5zq indexVal_s5zu
blockIDIndex_s5zv runStateContT_s5zw $ccatch_s5zx go_s5zy
$fTraversableFCkCtxAssignment_s5zH
$fTraversableFCkCtxAssignment_s5zI $fFunctorStateContT_s5A1
$c<$_s5A2 $fApplicativeStateContT_s5At $fApplicativeStateContT_s5Au
$fMonadStateContT_s5BE $creturn_s5BG $c>>_s5C9 $trModule_s5El
$trModule_s5Em $trModule_s5En $trModule_s5Eo $tcSome_s5EI
$tcSome_s5EJ $krep_s5EK $tc'Some_s5EM $tc'Some_s5EN
$tcFunctorF_s5EO $tcFunctorF_s5EP $tcCtx_s5EQ $tcCtx_s5ER
$krep_s5ES $tc'EmptyCtx_s5ET $tc'EmptyCtx_s5EU $tc'::>_s5EW
$tc'::>_s5EX $krep_s5EY $krep_s5EZ $krep_s5F0 $tcHeight_s5F1
$tcHeight_s5F2 $tc'Zero_s5F3 $tc'Zero_s5F4 $tc'Succ_s5F5
$tc'Succ_s5F6 $tcBalancedTree_s5F8 $tcBalancedTree_s5F9 $krep_s5Fa
$krep_s5Fb $krep_s5Fc $krep_s5Fd $tc'BalLeaf_s5Fe $tc'BalLeaf_s5Ff
$tcBinomialTree_s5Fg $tcBinomialTree_s5Fh $krep_s5Fi $krep_s5Fj
$krep_s5Fk $krep_s5Fl $krep_s5Fm $krep_s5Fn $krep_s5Fo $krep_s5Fp
$tc'Empty_s5Fq $tc'Empty_s5Fr $krep_s5Fu $krep_s5Fv
$tc'PlusZero_s5Fw $tc'PlusZero_s5Fx $krep_s5FA $krep_s5FB
$tcAssignment_s5FC $tcAssignment_s5FD $krep_s5FG
$tc'Assignment_s5FH $tc'Assignment_s5FI $tcIndex_s5FJ $tcIndex_s5FK
$krep_s5FM $tc'Index_s5FO $tc'Index_s5FP $tcSize_s5FQ $tcSize_s5FR
$tc'Size_s5FU $tc'Size_s5FV $tcFunctorFC_s5FW $tcFunctorFC_s5FX
$tcFoldableFC_s5FY $tcFoldableFC_s5FZ $tcTraversableFC_s5G0
$tcTraversableFC_s5G1 $tcCrucibleType_s5G2 $tcCrucibleType_s5G3
$krep_s5G4 $krep_s5G6 $krep_s5G7 $krep_s5G8 $tcTypeRepr_s5G9
$tcTypeRepr_s5Ga $krep_s5Gb $krep_s5Gc $krep_s5Gd $tcBlockID_s5Ge
$tcBlockID_s5Gf $tc'BlockID_s5Gi $tc'BlockID_s5Gj $krep_s5Gl
$tcBlock_s5Gm $tcBlock_s5Gn $krep_s5Gr $krep_s5Gt $krep_s5Gu
$tc'Block_s5GA $tc'Block_s5GB $tcCFG_s5GC $tcCFG_s5GD $tc'CFG_s5GH
$tc'CFG_s5GI $tcLLVM_s5GJ $tcLLVM_s5GK $tcAnyCFG_s5GL
$tcAnyCFG_s5GM $tc'AnyCFG_s5GO $tc'AnyCFG_s5GP $tcStateContT_s5GQ
$tcStateContT_s5GR $krep_s5GT $krep_s5GU $krep_s5GV $krep_s5GW
$tc'StateContT_s5GX $tc'StateContT_s5GY $tcTopLevelRO_s5GZ
$tcTopLevelRO_s5H0 $tcTopLevelRW_s5H1 $tcTopLevelRW_s5H2
$tcValue_s5H3 $tcValue_s5H4 $krep_s5H5 $krep_s5H6 $krep_s5H7
$krep_s5H8 $krep_s5H9 $krep_s5Ha $krep_s5Hc $krep_s5Hd
$tcTopLevel_s5He $tcTopLevel_s5Hf $tc'TopLevel__s5Hh
$tc'TopLevel__s5Hi $tcHint_s5Hj $tcHint_s5Hk $krep_s5Hl
$tcPermEnv_s5Hm $tcPermEnv_s5Hn $tc'PermEnv_s5Ho $tc'PermEnv_s5Hp
$krep_s5Hq $tcHeapsterEnv_s5Hr $tcHeapsterEnv_s5Hs
$tc'HeapsterEnv_s5Ht $tc'HeapsterEnv_s5Hu $tcRList_s5Hv
$tcRList_s5Hw $tc'RNil_s5Hy $tc'RNil_s5Hz $tc':>_s5HA $tc':>_s5HB
$fFoldableFCkCtxAssignment_s5Po $c*>_s5Pp $cliftA2_s5Pq $c<*_s5Ps
$creturn_s5Pu $cthrowM_s5Pv $ccatch_s5Pw ipv_s5PP ipv_s5PQ ipv_s5PR
$s$fMonadFailStateContT_s5Ro $scatches_s5RP $sfoldlM_s5Se
$s$fMonadFailReaderT_$cfail_s5Sz $s$fMonadReaderT_$c>>=_s5SB
$s$fApplicativeReaderT_$c<*_s5SD $s$fApplicativeReaderT_$c*>_s5SF
$s$fApplicativeReaderT_$cliftA2_s5SH
$s$fApplicativeReaderT_$c<*>_s5SJ $s$fFunctorReaderT_$c<$_s5SN
$s$fFunctorReaderT_$cfmap_s5SP go_s5T6 lvl_s5T7 lvl_s5T8 lvl_s5Tb
lvl_s5Tc lvl_s5Tf eta_s5Tj m1_s5Tn lvl_s5Tp lvl_s5Tq lvl_s5Tx
lvl_s5Ty lvl_s5TB karg_s5U0 io_s5Up lvl_s5Us go1_s5Uz eta_s5UI
$wgo_s5Vj lvl_s5Xj lvl_s5Xk lvl_s5Xl lvl_s5Xm sc_s5Xw sc_s5Xx
sc_s5Xy sg_s5Xz $sgo1_s5XA $sgo1_s5ZU}
eta_B4
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/Core/Opt/Simplify/Env.hs:706:30 in ghc:GHC.Core.Opt.Simplify.Env
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
</details>
On the other hand, this does _not_ panic when built with 9.2.4 or 9.4.2:
<details>
```
$ ghc-9.2.4 Bug.hs -O2 -fforce-recomp
[1 of 1] Compiling SAWScript.HeapsterBuiltins ( Bug.hs, Bug.o )
$ ghc-9.4.2 Bug.hs -O2 -fforce-recomp
[1 of 1] Compiling SAWScript.HeapsterBuiltins ( Bug.hs, Bug.o )
```
</details>9.2.6https://gitlab.haskell.org/ghc/ghc/-/issues/14829Linking error with ANN pragma2023-02-08T19:40:44ZehubinetteLinking error with ANN pragmaThere seems to be an issue with the ANN pragma, with fatal compilation errors.
To reproduce, setup two modules as such:
```hs
module Test where
import Weights (Weight(..))
{-# ANN mainTest (Weight 2) #-}
mainTest :: IO ()
mainTest = ...There seems to be an issue with the ANN pragma, with fatal compilation errors.
To reproduce, setup two modules as such:
```hs
module Test where
import Weights (Weight(..))
{-# ANN mainTest (Weight 2) #-}
mainTest :: IO ()
mainTest = return ()
```
```hs
{-# LANGUAGE DeriveDataTypeable #-}
module Weights (Weight(..)) where
import Data.Data (Data(..))
newtype Weight = Weight Integer deriving Data
```
Compiling with GHC version `8.2.2` yields:
```
λ ghc Test.hs
[1 of 2] Compiling Weights ( Weights.hs, Weights.o )
[2 of 2] Compiling Test ( Test.hs, Test.o )
Test.hs:5:1: fatal:
cannot find object file ‘./Weights.dyn_o’
while linking an interpreted expression
```
The issue disappears with `-dynamic` or `-dynamic-too`:
```
λ ghc -dynamic Test.hs
[1 of 2] Compiling Weights ( Weights.hs, Weights.o )
[2 of 2] Compiling Test ( Test.hs, Test.o )
```
Issue persist in HEAD, GHC version `8.5.20180219`, but again disappears with `-dynamic-too` *or* `-dynamic`:
```
λ ../../ghc/inplace/bin/ghc-stage2 -dynamic-too Test.hs
[1 of 2] Compiling Weights ( Weights.hs, Weights.o )
[2 of 2] Compiling Test ( Test.hs, Test.o )
```
Remove the ANN pragma, and the compiler behaves just fine with both GHC versions. Please tell me if I can provide more information. Cheers.https://gitlab.haskell.org/ghc/ghc/-/issues/22807-fprefer-byte-code panics when combined with -fno-omit-interface-pragmas2023-02-08T00:37:32ZAlexis King-fprefer-byte-code panics when combined with -fno-omit-interface-pragmasThe following two modules can be used to trigger a panic on GHC HEAD:
```haskell
module A where
xs :: [a]
xs = []
```
```haskell
{-# LANGUAGE TemplateHaskell #-}
module B where
import A
$(pure xs)
```
```sh
$ rm -f *.{o,hi} # ensure d...The following two modules can be used to trigger a panic on GHC HEAD:
```haskell
module A where
xs :: [a]
xs = []
```
```haskell
{-# LANGUAGE TemplateHaskell #-}
module B where
import A
$(pure xs)
```
```sh
$ rm -f *.{o,hi} # ensure directory is clean
$ ghc -fno-omit-interface-pragmas -fwrite-if-simplified-core -fbyte-code-and-object-code -fprefer-byte-code A
[1 of 1] Compiling A ( A.hs, A.o, interpreted )
$ ghc -fwrite-if-simplified-core -fbyte-code-and-object-code -fprefer-byte-code B
[2 of 2] Compiling B ( B.hs, B.o, interpreted )
<no location info>: error: No match in record selector uf_tmpl
```
The error message is uninformative, but a little investigation reveals that the failing call to `uf_tmpl` is in `GHC.IfaceToCore.tc_iface_binding`.9.6.1Matthew PickeringMatthew Pickering