GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2020-12-14T13:50:30Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/17305Data family instances aren't eta-reduced correctly2020-12-14T13:50:30ZRyan ScottData family instances aren't eta-reduced correctly(I originally discovered this when debugging #17296/!1877, but this doesn't rely on !1877 to reproduce.)
Take this code:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
impo...(I originally discovered this when debugging #17296/!1877, but this doesn't rely on !1877 to reproduce.)
Take this code:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
import Language.Haskell.TH hiding (Type)
import System.IO
data family Foo a
data instance Foo :: Type -> Type where
MkFoo :: Foo a
$(do i <- reify ''Foo
runIO $ hPutStrLn stderr $ pprint i
pure [])
```
And compile it with a `devel2`-flavoured compiler. (I'm on commit d0924b153b093a925c9e721f2540f3dfd6c278ae.) You'll get the following panic:
```
$ ~/Software/ghc3/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o, Bug.dyn_o )
Bug.hs:1:1: error:
Exception when trying to run compile-time code:
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.9.0.20191003:
zipEqual: unequal lists:zipTyEnv
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Code: do i <- reify ''Foo
runIO $ hPutStrLn stderr $ pprint i
pure []
|
1 | {-# LANGUAGE GADTs #-}
| ^
```8.10.2https://gitlab.haskell.org/ghc/ghc/-/issues/17269T13615 fails in unrelated MRs2020-01-21T14:15:36ZSebastian GrafT13615 fails in unrelated MRsCurrently, `T13615` consistently fails for both !1828 (which fixes a bug in the rule matcher) and !1830 (which just adds some test cases and doesn't touch the compiler *at all*). [Example job 1](https://gitlab.haskell.org/ghc/ghc/-/jobs/...Currently, `T13615` consistently fails for both !1828 (which fixes a bug in the rule matcher) and !1830 (which just adds some test cases and doesn't touch the compiler *at all*). [Example job 1](https://gitlab.haskell.org/ghc/ghc/-/jobs/166384), [Example job 2](https://gitlab.haskell.org/ghc/ghc/-/jobs/166305).
- It only affects validate-x86_64-linux-deb9-debug, probably because the particular configuration isn't run in the other CI flavors
- In both cases the error is
```
Wrong exit code for T13615(threaded1)(expected 0 , actual 139 )
Stderr ( T13615 ):
Segmentation fault (core dumped)
```
Not sure what's happening there.8.10.2https://gitlab.haskell.org/ghc/ghc/-/issues/17203ghc-8.6.5 fails to build gtk2hs-buildtools on ppc64le2021-08-04T20:55:19ZJens Petersenghc-8.6.5 fails to build gtk2hs-buildtools on ppc64le## Summary
See https://bugzilla.redhat.com/show_bug.cgi?id=1737587
On ppc64le ghc-8.6.5 fails to link `gtk2hsC2hs` from gtk2hs-buildtools (0.13.5).
```
Preprocessing executable 'gtk2hsC2hs' for gtk2hs-buildtools-0.13.5.0..
Building ex...## Summary
See https://bugzilla.redhat.com/show_bug.cgi?id=1737587
On ppc64le ghc-8.6.5 fails to link `gtk2hsC2hs` from gtk2hs-buildtools (0.13.5).
```
Preprocessing executable 'gtk2hsC2hs' for gtk2hs-buildtools-0.13.5.0..
Building executable 'gtk2hsC2hs' for gtk2hs-buildtools-0.13.5.0..
[1 of 1] Compiling Main ( exe/gtk2hsC2hsMain.hs, dist/build/gtk2hsC2hs/gtk2hsC2hs-tmp/Main.o )
Linking dist/build/gtk2hsC2hs/gtk2hsC2hs ...
BUILDSTDERR: /builddir/build/BUILD/gtk2hs-buildtools-0.13.5.0/dist/build/libHSgtk2hs-buildtools-0.13.5.0-KQlf14Qb9I4Aj3qfo8QuZi.a(Binary.o)(.data+0x1798): error: undefined reference to 'crcF_closure'
BUILDSTDERR: /builddir/build/BUILD/gtk2hs-buildtools-0.13.5.0/dist/build/libHSgtk2hs-buildtools-0.13.5.0-KQlf14Qb9I4Aj3qfo8QuZi.a(Binary.o)(.data.rel.ro+0x4720): error: undefined reference to 'crcF_closure'
BUILDSTDERR: /builddir/build/BUILD/gtk2hs-buildtools-0.13.5.0/dist/build/libHSgtk2hs-buildtools-0.13.5.0-KQlf14Qb9I4Aj3qfo8QuZi.a(Binary.o)(.data.rel.ro+0x4740): error: undefined reference to 'crcF_closure'
BUILDSTDERR: /builddir/build/BUILD/gtk2hs-buildtools-0.13.5.0/dist/build/libHSgtk2hs-buildtools-0.13.5.0-KQlf14Qb9I4Aj3qfo8QuZi.a(Binary.o)(.data.rel.ro+0x4760): error: undefined reference to 'crcF_closure'
BUILDSTDERR: collect2: error: ld returned 1 exit status
BUILDSTDERR: `gcc' failed in phase `Linker'. (Exit code: 1)
```
## Steps to reproduce
Roughly:
0. login to ppc64le with ghc-8.6.5 (eg Fedora 31 devel)
1. cabal install gtk2hs-buildtools
(On fedora more preciously:
```
$ sudo dnf install fedpkg
$ fedpkg clone -a gtk2hs-buildtools
$ cd gtk2hs-buildtools
$ sudo dnf builddep ./gtk2hs-buildtools.spec
$ fedpkg local
```
)
gtk2hs-buildtools fine on ppc64le with ghc-8.4.4 (Fedora 30).
I haven't tried building with Fedora ghc:8.6 module on Fedora 30.
## Expected behavior
Finish building normally
## Environment
* GHC version used: 8.6.5
Optional:
* Operating System: Linux (Fedora 31)
* System Architecture: ppc64lehttps://gitlab.haskell.org/ghc/ghc/-/issues/16840"panic! (the 'impossible' happened)" attempting to print the contents of a mu...2021-06-29T14:01:50ZAnthony Berent"panic! (the 'impossible' happened)" attempting to print the contents of a mutable vector in GHCi# Summary
I got an panic when trying to print the contents of a mutable vector while debugging using "toList $ freeze t" in GHCi (t is my vector).
The full message is:
```
[/home/anthony/haskell/SubStringSearching/app/Main.hs:32:7-17]...# Summary
I got an panic when trying to print the contents of a mutable vector while debugging using "toList $ freeze t" in GHCi (t is my vector).
The full message is:
```
[/home/anthony/haskell/SubStringSearching/app/Main.hs:32:7-17] >toList $ freeze t
<interactive>:39:17: error:<interactive>: panic! (the 'impossible' happened)
(GHC version 8.6.5 for x86_64-unknown-linux):
No skolem info:
[s_I8aZ[rt]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcErrors.hs:2891:5 in ghc:TcErrors
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
[/home/anthony/haskell/SubStringSearching/app/Main.hs:32:7-17] >
```
# Steps to reproduce
* In GHCi set a breakpoint on line 37 of the attached source code [Main.hs](/uploads/e5a86827ffee9892909bbbd1a5df58c1/Main.hs)
* Step through the code until it reaches Main.hs:32:7-17
* Run the command: *toList $ freeze t*
# Expected behavior
Not a panic, probably print the contents of t.
# Environment
* GHC version used: 8.6.5 for x86_64-unknown-linux
Optional:
* Operating System: Ubuntu 19.04
* System Architecture:https://gitlab.haskell.org/ghc/ghc/-/issues/16799T7702 segfaults on Windows2020-02-14T15:17:35ZBen GamariT7702 segfaults on Windows`T7702` reliably fails with a segmentation fault on Windows. The crash looks something like:
```
Compile failed (exit code 11) errors were:
Access violation in generated code when reading 0xb790
Attempting to reconstruct a stack trace...`T7702` reliably fails with a segmentation fault on Windows. The crash looks something like:
```
Compile failed (exit code 11) errors were:
Access violation in generated code when reading 0xb790
Attempting to reconstruct a stack trace...
Frame Code address
* 0x3fff850 0x2ffc023 C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bfc023
* 0x3fff8d0 0x2fd054c C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bd054c
* 0x3fff940 0x2fc5a7f C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bc5a7f
* 0x3fffa90 0x2fc63ff C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bc63ff
* 0x3fffb80 0x2fbb030 C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bbb030
* 0x3fffc30 0x2fbb9ea C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bbb9ea
* 0x3fffc80 0x2fbc7db C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bbc7db
* 0x3fffd40 0x2fb27a5 C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x2bb27a5
* 0x3fffe50 0x4da5d8 C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0xda5d8
* 0x3ffff20 0x4013f8 C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x13f8
* 0x3ffff50 0x40151b C:\GitLabRunner\builds\78d7d3f9\0\ghc\ghc\inplace\bin\ghc-stage2.exe+0x151b
* 0x3ffff80 0x7ffcd88d84d4 C:\Windows\System32\KERNEL32.DLL+0x84d4
* 0x3ffffd0 0x7ffcd8f6e851 C:\Windows\SYSTEM32\ntdll.dll+0x6e851
Failed to find metric: peak_megabytes_allocated
*** unexpected failure for T7702(normal)
```https://gitlab.haskell.org/ghc/ghc/-/issues/16587SIGSEGV in GHCi when accelerate in set of dependencies2019-04-18T22:10:56ZSDNWSIGSEGV in GHCi when accelerate in set of dependenciesWhenever a library or executable depends on `accelerate` it crashes GHCi 8.6.4
```
executable bug
main-is: Main.hs
build-depends: base, accelerate
default-language: Haskell2010
```
```
Build profile: -w ghc-...Whenever a library or executable depends on `accelerate` it crashes GHCi 8.6.4
```
executable bug
main-is: Main.hs
build-depends: base, accelerate
default-language: Haskell2010
```
```
Build profile: -w ghc-8.6.4 -O1
In order, the following will be built (use -v for more details):
- package-0.1.0.0 (exe:bug) (first run)
Configuring executable 'bug' for package-0.1.0.0..
Preprocessing executable 'bug' for package-0.1.0.0..
GHCi, version 8.6.4: http://www.haskell.org/ghc/ :? for help
cabal: repl failed for exe:bug from package-0.1.0.0. The build process segfaulted (i.e. SIGSEGV).
```https://gitlab.haskell.org/ghc/ghc/-/issues/16465powerpc: SCCs aren't in reverse dependent order2019-10-31T01:20:20ZSergei Trofimovichpowerpc: SCCs aren't in reverse dependent orderCurrent ghc-HEAD fails build as:
```
$ ./configure --target=powerpc-unknown-linux-gnu
$ make
...
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===---...Current ghc-HEAD fails build as:
```
$ ./configure --target=powerpc-unknown-linux-gnu
$ make
...
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f ghc.mk phase=1 phase_1_builds
make[1]: Nothing to be done for 'phase_1_builds'.
===--- building final phase
make --no-print-directory -f ghc.mk phase=final all
"inplace/bin/ghc-stage1" -static -H32m -O -Wall -Iincludes -Iincludes/dist -Iincludes/dist-derivedconstants/header -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build -DCOMPILING_RTS -DFS_NAMESPACE=rts -this-unit-id rts -dcmm-lint -i -irts -irts/dist/build -Irts/dist/build -irts/dist/build/./autogen -Irts/dist/build/./autogen -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/HeapStackCheck.cmm -o rts/dist/build/HeapStackCheck.o
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.9.20190318 for powerpc-unknown-linux):
RegAlloc.Liveness.computeLiveness
SCCs aren't in reverse dependent order
bad blockId n3U
[NONREC
cw: li %vI_n3Y, 1
lwz %vI_n3Z, 812(27)
sth %vI_n3Y, 16(%vI_n3Z)
stw %vI_c1, 832(27)
mr 14, 27
b stg_returnToSched,
NONREC
ct: lwz %vI_n3X, 0(24)
mtctr %vI_n3X
bctr,
NONREC
c9: li %vI_c1, 3
b _cw,
NONREC
cs: lwz %vI_n3V, 812(27)
lwz %vI_n3W, 20(%vI_n3V)
andi. 0, %vI_n3W, 256
bne _c9
b _ct,
NONREC
n3T:
bge _ct
b _cs,
NONREC
cr: lwz %vI_n3Q, 812(27)
lwz %vI_n3R, 68(%vI_n3Q)
lwz %vHi_H3R, 64(%vI_n3Q)
lis %vI_n3S, 0
ori %vI_n3S, %vI_n3S, 0
lis %vHi_H3S, 0
ori %vHi_H3S, %vHi_H3S, 0
cmpw %vHi_H3R, %vHi_H3S
bne _n3T
cmpwi %vHi_H3R, 0
ble _n3U
cmplw %vI_n3R, %vI_n3S
b _n3T
cmplw %vI_n3S, %vI_n3R
b _n3T,
NONREC
cq: lwz %vI_n3P, 912(27)
cmpwi %vI_n3P, 0
bne _c9
b _cr,
NONREC
cc: li %vI_n3j, 0
stw %vI_n3j, 828(27)
lwz %vI_cj, 820(27)
addi %vI_n3k, 26, 4
stw %vI_n3k, 4(%vI_cj)
lwz %vI_ci, 812(27)
lwz %vI_n3l, 68(%vI_ci)
lwz %vHi_H3l, 64(%vI_ci)
lwz %vI_n3m, 0(%vI_cj)
addi %vI_n3n, 26, 4
subf %vI_n3o, %vI_n3m, %vI_n3n
mr %vI_n3p, %vI_n3o
li %vHi_H3p, 0
subfc %vI_n3q, %vI_n3p, %vI_n3l
subfe %vHi_H3q, %vHi_H3p, %vHi_H3l
stw %vI_n3q, 68(%vI_ci)
stw %vHi_H3q, 64(%vI_ci)
lwz %vI_n3r, 916(27)
lwz %vI_n3s, 820(27)
lwz %vI_n3t, 0(%vI_n3s)
lwz %vI_n3u, 820(27)
lwz %vI_n3v, 4(%vI_n3u)
subf %vI_n3w, %vI_n3t, %vI_n3v
srwi %vI_n3x, %vI_n3w, 2
add %vI_n3y, %vI_n3r, %vI_n3x
stw %vI_n3y, 916(27)
lwz %vI_n3z, 820(27)
lwz %vI_n3A, 8(%vI_n3z)
stw %vI_n3A, 820(27)
lwz %vI_n3B, 820(27)
lwz %vI_n3C, 0(%vI_n3B)
lwz %vI_n3D, 820(27)
stw %vI_n3C, 4(%vI_n3D)
lwz %vI_cl, 820(27)
lwz %vI_cm, 4(%vI_cl)
addi 26, %vI_cm, -4
lwz %vI_cn, 0(%vI_cl)
lwz %vI_n3E, 28(%vI_cl)
slwi %vI_n3F, %vI_n3E, 12
addi %vI_n3G, %vI_n3F, -1
add %vI_n3H, %vI_cn, %vI_n3G
stw %vI_n3H, 804(27)
lwz %vI_ck, 812(27)
lwz %vI_n3I, 68(%vI_ck)
lwz %vHi_H3I, 64(%vI_ck)
subf %vI_n3J, %vI_cn, %vI_cm
mr %vI_n3K, %vI_n3J
li %vHi_H3K, 0
addc %vI_n3L, %vI_n3I, %vI_n3K
adde %vHi_H3L, %vHi_H3I, %vHi_H3K
stw %vI_n3L, 68(%vI_ck)
stw %vHi_H3L, 64(%vI_ck)
lwz %vI_n3M, 908(27)
cmpwi %vI_n3M, 0
bne _c9
b _cq,
NONREC
c8: li %vI_c1, 2
b _cw,
NONREC
c5: li %vI_c1, 1
b _cw,
NONREC
c7: lis %vI_n3d, g0@ha
lwz %vI_n3e, g0@l(%vI_n3d)
lwz %vI_n3f, 28(%vI_n3e)
lis %vI_n3g, large_alloc_lim@ha
lwz %vI_n3h, large_alloc_lim@l(%vI_n3g)
cmplw %vI_n3f, %vI_n3h
bge _c5
b _c8,
NONREC
ce: lwz %vI_n3N, 820(27)
lwz %vI_n3O, 8(%vI_n3N)
cmpwi %vI_n3O, 0
beq _c5
b _cc,
NONREC
cb: lwz %vI_n3i, 828(27)
cmplwi %vI_n3i, 4096
bgt _c5
b _ce,
NONREC
c4: lwz %vI_n3b, 820(27)
lwz %vI_n3c, 8(%vI_n3b)
cmpwi %vI_n3c, 0
beq _c5
b _c7,
NONREC
c2: lwz %vI_n39, 828(27)
subf 26, %vI_n39, 26
lwz %vI_n3a, 804(27)
cmpwi %vI_n3a, 0
beq _c9
b _cb,
NONREC
cx: lwz %vI_n38, 804(27)
cmplw 26, %vI_n38
bgt _c2
b _c4]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1169:37 in ghc:Outputable
pprPanic, called at compiler/nativeGen/RegAlloc/Liveness.hs:831:28 in ghc:RegAlloc.Liveness
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
make[1]: *** [rts/ghc.mk:318: rts/dist/build/HeapStackCheck.o] Error 1
make: *** [Makefile:128: all] Error 2
```
A bit of extra detail on stage1:
```
$ inplace/bin/ghc-stage1 --info
[("Project name","The Glorious Glasgow Haskell Compilation System")
,("GCC extra via C opts"," -fwrapv -fno-builtin")
,("C compiler command","powerpc-unknown-linux-gnu-gcc")
,("C compiler flags","")
,("C compiler link flags"," -fuse-ld=gold")
,("C compiler supports -no-pie","YES")
,("Haskell CPP command","powerpc-unknown-linux-gnu-gcc")
,("Haskell CPP flags","-E -undef -traditional")
,("ld command","powerpc-unknown-linux-gnu-ld.gold")
,("ld flags","")
,("ld supports compact unwind","YES")
,("ld supports build-id","YES")
,("ld supports filelist","NO")
,("ld is GNU ld","YES")
,("ar command","powerpc-unknown-linux-gnu-ar")
,("ar flags","q")
,("ar supports at file","YES")
,("ranlib command","powerpc-unknown-linux-gnu-ranlib")
,("touch command","touch")
,("dllwrap command","/bin/false")
,("windres command","/bin/false")
,("libtool command","libtool")
,("cross compiling","YES")
,("target os","OSLinux")
,("target arch","ArchPPC")
,("target word size","4")
,("target has GNU nonexec stack","True")
,("target has .ident directive","True")
,("target has subsections via symbols","False")
,("target has RTS linker","YES")
,("Unregisterised","NO")
,("LLVM llc command","llc")
,("LLVM opt command","opt")
,("LLVM clang command","clang")
,("Project version","8.9.20190318")
,("Project Git commit id","6113d0d4540af7853c71e9f42a41c3b0bab386fd")
,("Booter version","8.6.4")
,("Stage","1")
,("Build platform","x86_64-unknown-linux")
,("Host platform","x86_64-unknown-linux")
,("Target platform","powerpc-unknown-linux")
,("Have interpreter","YES")
,("Object splitting supported","NO")
,("Have native code generator","YES")
,("Support SMP","YES")
,("Tables next to code","YES")
,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn thr_debug_p debug_p")
,("RTS expects libdw","NO")
,("Support dynamic-too","YES")
,("Support parallel --make","YES")
,("Support reexported-modules","YES")
,("Support thinning and renaming package flags","YES")
,("Support Backpack","YES")
,("Requires unified installed package IDs","YES")
,("Uses package keys","YES")
,("Uses unit IDs","YES")
,("Dynamic by default","NO")
,("GHC Dynamic","NO")
,("GHC Profiled","NO")
,("Leading underscore","NO")
,("Debug on","False")
,("LibDir","/home/slyfox/dev/git/ghc-ppc/inplace/lib")
,("Global Package DB","/home/slyfox/dev/git/ghc-ppc/inplace/lib/package.conf.d")
]
```https://gitlab.haskell.org/ghc/ghc/-/issues/16383ghc: internal error: getMBlock: mmap: Invalid argument (gi-gtk on armv7)2019-07-07T18:00:18ZJens Petersenghc: internal error: getMBlock: mmap: Invalid argument (gi-gtk on armv7)When trying to build gi-gtk-3.0.26 with ghc-8.4.4 on Fedora 30 armv7hl, ghc crashes like this:
```
[484 of 498] Compiling GI.Gtk.Functions ( GI/Gtk/Functions.hs, dist/build/GI/Gtk/Functions.o )
BUILDSTDERR: ghc: internal error: getMBloc...When trying to build gi-gtk-3.0.26 with ghc-8.4.4 on Fedora 30 armv7hl, ghc crashes like this:
```
[484 of 498] Compiling GI.Gtk.Functions ( GI/Gtk/Functions.hs, dist/build/GI/Gtk/Functions.o )
BUILDSTDERR: ghc: internal error: getMBlock: mmap: Invalid argument
BUILDSTDERR: (GHC version 8.4.4 for arm_unknown_linux)
BUILDSTDERR: Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
BUILDSTDERR: /var/tmp/rpm-tmp.McmHQu: line 52: 5271 Aborted (core dumped) ./Setup build
```
https://koji.fedoraproject.org/koji/taskinfo?taskID=33138502
gi-gtk built fine before on ghc-8.2.2 armv7.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.4 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc: internal error: getMBlock: mmap: Invalid argument (gi-gtk on armv7)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When trying to build gi-gtk-3.0.26 with ghc-8.4.4 on Fedora 30 armv7hl, ghc crashes like this:\r\n\r\n{{{\r\n[484 of 498] Compiling GI.Gtk.Functions ( GI/Gtk/Functions.hs, dist/build/GI/Gtk/Functions.o )\r\nBUILDSTDERR: ghc: internal error: getMBlock: mmap: Invalid argument\r\nBUILDSTDERR: (GHC version 8.4.4 for arm_unknown_linux)\r\nBUILDSTDERR: Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\nBUILDSTDERR: /var/tmp/rpm-tmp.McmHQu: line 52: 5271 Aborted (core dumped) ./Setup build\r\n}}}\r\n\r\nhttps://koji.fedoraproject.org/koji/taskinfo?taskID=33138502\r\n\r\ngi-gtk built fine before on ghc-8.2.2 armv7.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/16246GHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion t...2020-01-23T19:39:43ZRyan ScottGHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion type)```hs
module Foo where
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Syntax
ueqT :: Q Type
ueqT = conT $ mkNameG_tc "ghc-prim" "GHC.Prim" "~#"
```
```hs
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE T...```hs
module Foo where
import Language.Haskell.TH.Lib
import Language.Haskell.TH.Syntax
ueqT :: Q Type
ueqT = conT $ mkNameG_tc "ghc-prim" "GHC.Prim" "~#"
```
```hs
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Data.Kind
import Foo (ueqT)
data JankyEquality :: Type -> Type -> Type where
Jank :: $ueqT a b -> JankyEquality a b
unJank :: JankyEquality a b -> $ueqT a b
unJank (Jank x) = x
```
```
$ ~/Software/ghc5/inplace/bin/ghc-stage2 --interactive Bug.hs -dcore-lint
GHCi, version 8.7.20190115: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 2] Compiling Foo ( Foo.hs, interpreted )
[2 of 2] Compiling Bug ( Bug.hs, interpreted )
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In a case alternative: (Jank x_a4vR :: a_a4wC ~# b_a4wD)
Non-CoVar has coercion type x_a4vR :: a_a4wC ~# b_a4wD
*** Offending Program ***
<elided>
unJank :: forall a b. JankyEquality a b -> a ~# b
[LclIdX]
unJank
= \ (@ a_a4wC)
(@ b_a4wD)
(ds_d4wN :: JankyEquality a_a4wC b_a4wD) ->
case ds_d4wN of wild_00 { Jank x_a4vR -> break<0>() x_a4vR }
```
Note that this passes `-dcore-lint` on GHC 8.0.2 through 8.6.3.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC HEAD-only Core Lint error with unboxed equality (Non-CoVar has coercion type)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.10.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\nmodule Foo where\r\n\r\nimport Language.Haskell.TH.Lib\r\nimport Language.Haskell.TH.Syntax\r\n\r\nueqT :: Q Type\r\nueqT = conT $ mkNameG_tc \"ghc-prim\" \"GHC.Prim\" \"~#\"\r\n}}}\r\n{{{#!hs\r\n{-# LANGUAGE KindSignatures #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Foo (ueqT)\r\n\r\ndata JankyEquality :: Type -> Type -> Type where\r\n Jank :: $ueqT a b -> JankyEquality a b\r\n\r\nunJank :: JankyEquality a b -> $ueqT a b\r\nunJank (Jank x) = x\r\n}}}\r\n{{{\r\n$ ~/Software/ghc5/inplace/bin/ghc-stage2 --interactive Bug.hs -dcore-lint\r\nGHCi, version 8.7.20190115: https://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 2] Compiling Foo ( Foo.hs, interpreted )\r\n[2 of 2] Compiling Bug ( Bug.hs, interpreted )\r\n*** Core Lint errors : in result of Desugar (before optimization) ***\r\n<no location info>: warning:\r\n In a case alternative: (Jank x_a4vR :: a_a4wC ~# b_a4wD)\r\n Non-CoVar has coercion type x_a4vR :: a_a4wC ~# b_a4wD\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\nunJank :: forall a b. JankyEquality a b -> a ~# b\r\n[LclIdX]\r\nunJank\r\n = \\ (@ a_a4wC)\r\n (@ b_a4wD)\r\n (ds_d4wN :: JankyEquality a_a4wC b_a4wD) ->\r\n case ds_d4wN of wild_00 { Jank x_a4vR -> break<0>() x_a4vR }\r\n}}}\r\n\r\nNote that this passes `-dcore-lint` on GHC 8.0.2 through 8.6.3.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/16135Assertion failure with ExistentialQuantification and ApplicativeDo2024-03-28T05:02:38ZAshley YakeleyAssertion failure with ExistentialQuantification and ApplicativeDo```hs
{-# LANGUAGE ExistentialQuantification, ApplicativeDo #-}
module Bug where
data T f = forall a. MkT (f a)
runf :: forall f. Functor f => IO (T f)
runf = do
return ()
MkT fa <- runf
return $ MkT fa
```
```
Bug.hs:11:...```hs
{-# LANGUAGE ExistentialQuantification, ApplicativeDo #-}
module Bug where
data T f = forall a. MkT (f a)
runf :: forall f. Functor f => IO (T f)
runf = do
return ()
MkT fa <- runf
return $ MkT fa
```
```
Bug.hs:11:18: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.6.3 for x86_64-unknown-linux):
No skolem info:
[a_a1nb[ssk:2]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcErrors.hs:2891:5 in ghc:TcErrors
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```https://gitlab.haskell.org/ghc/ghc/-/issues/16063ghc-8.6.3 + Mac OSX + FFI dependency causes 'impossible happened' compiler f...2023-03-19T03:34:56Zbenselfridgeghc-8.6.3 + Mac OSX + FFI dependency causes 'impossible happened' compiler failureI am trying to build this library: https://github.com/GaloisInc/grift
The build works perfectly on my Mac OS X system under ghc-8.4.4 via the README instructions. However, if I update to ghc-8.6.3, I get the following error:
```
Buildi...I am trying to build this library: https://github.com/GaloisInc/grift
The build works perfectly on my Mac OS X system under ghc-8.4.4 via the README instructions. However, if I update to ghc-8.6.3, I get the following error:
```
Building library for bv-sized-float-0.1.0..
[1 of 2] Compiling Data.BitVector.Sized.Float ( src/Data/BitVector/Sized/Float.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float.o )
[2 of 2] Compiling Data.BitVector.Sized.Float.App ( src/Data/BitVector/Sized/Float/App.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float/App.o )
ghc: loadArchive: Failed reading header from `/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat'
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.3 for x86_64-apple-darwin):
loadArchive "/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The library "softfloat-hs" is a Haskell library that calls C functions that are dynamically linked. If I try to run it within this project via "cabal new-repl softfloat-hs", the dependency works fine. It's only when I try to build "bv-sized-float", which depends on softfloat-hs, that I get the above error.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"ghc-8.6.3 + Mac OSX + FFI dependency causes 'impossible happened' compiler failure","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I am trying to build this library: https://github.com/GaloisInc/grift\r\n\r\nThe build works perfectly on my Mac OS X system under ghc-8.4.4 via the README instructions. However, if I update to ghc-8.6.3, I get the following error:\r\n\r\n{{{\r\nBuilding library for bv-sized-float-0.1.0..\r\n[1 of 2] Compiling Data.BitVector.Sized.Float ( src/Data/BitVector/Sized/Float.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float.o )\r\n[2 of 2] Compiling Data.BitVector.Sized.Float.App ( src/Data/BitVector/Sized/Float/App.hs, /Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/bv-sized-float-0.1.0/build/Data/BitVector/Sized/Float/App.o )\r\nghc: loadArchive: Failed reading header from `/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat'\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.3 for x86_64-apple-darwin):\r\n\tloadArchive \"/Users/benselfridge/grift/dist-newstyle/build/x86_64-osx/ghc-8.6.3/softfloat-hs-0.1.0/build/SoftFloat\": failed\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThe library \"softfloat-hs\" is a Haskell library that calls C functions that are dynamically linked. If I try to run it within this project via \"cabal new-repl softfloat-hs\", the dependency works fine. It's only when I try to build \"bv-sized-float\", which depends on softfloat-hs, that I get the above error.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/16028tyThingCoAxiom panics while building Agda2019-07-07T18:01:58ZIlias TsitsimpistyThingCoAxiom panics while building Agdaghc-8.4.4 panics while building Agda on armhf (https://buildd.debian.org/status/fetch.php?pkg=agda&arch=armhf&ver=2.5.4.1-3%2Bb1&stamp=1544132023&raw=0):
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.4 for arm-unknown-l...ghc-8.4.4 panics while building Agda on armhf (https://buildd.debian.org/status/fetch.php?pkg=agda&arch=armhf&ver=2.5.4.1-3%2Bb1&stamp=1544132023&raw=0):
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.4 for arm-unknown-linux):
tyThingCoAxiom
Identifier ‘fromDescListWithKey’
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/main/HscTypes.hs:2153:32 in ghc:HscTypes
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The same version of Agda builds fine with ghc-8.4.3 on armhf (https://buildd.debian.org/status/fetch.php?pkg=agda&arch=armhf&ver=2.5.4.1-3&stamp=1540145469&raw=0).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.4 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"tyThingCoAxiom panics while building Agda","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.4","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.4","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"ghc-8.4.4 panics while building Agda on armhf (https://buildd.debian.org/status/fetch.php?pkg=agda&arch=armhf&ver=2.5.4.1-3%2Bb1&stamp=1544132023&raw=0):\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.4 for arm-unknown-linux):\r\n\ttyThingCoAxiom\r\n Identifier ‘fromDescListWithKey’\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable\r\n pprPanic, called at compiler/main/HscTypes.hs:2153:32 in ghc:HscTypes\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThe same version of Agda builds fine with ghc-8.4.3 on armhf (https://buildd.debian.org/status/fetch.php?pkg=agda&arch=armhf&ver=2.5.4.1-3&stamp=1540145469&raw=0).","type_of_failure":"OtherFailure","blocking":[]} -->8.6.4https://gitlab.haskell.org/ghc/ghc/-/issues/15984Backpack accepts ill-kinded instantiations. Can cause GHC panic2019-07-07T18:02:09ZaaronvargoBackpack accepts ill-kinded instantiations. Can cause GHC panicGiven the following:
```hs
{-# language KindSignatures #-}
signature A where
data A :: *
```
```hs
module Foo where
import A
foo :: A -> A
foo = id
```
```hs
module IllKindedA where
type A = Maybe
```
GHC allows the signature `A`...Given the following:
```hs
{-# language KindSignatures #-}
signature A where
data A :: *
```
```hs
module Foo where
import A
foo :: A -> A
foo = id
```
```hs
module IllKindedA where
type A = Maybe
```
GHC allows the signature `A` to be instantiated with `IllKindedA`:
```
mixins: foo (Foo as Bug) requires (A as IllKindedA)
```
Using the resulting module can cause odd errors or a panic. E.g. the following causes a panic:
```hs
module Bar where
import Bug
bar = foo
```
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-linux):
getRuntimeRep
A :: * -> *
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:2049:18 in ghc:Type
```8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15979Core Lint error with LiberalTypeSynonyms2022-12-08T17:36:30ZRyan ScottCore Lint error with LiberalTypeSynonymsSee main ticket #22063
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# OPTIONS_GHC -dcore-lint #-}
module Bug where
import Data.Kind
type KindOf (a :: k) = k
wat :: KindOf (forall...See main ticket #22063
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LiberalTypeSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# OPTIONS_GHC -dcore-lint #-}
module Bug where
import Data.Kind
type KindOf (a :: k) = k
wat :: KindOf (forall (a :: ()). a)
wat = ()
```
```
$ /opt/ghc/8.6.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In the type ‘KindOf (forall (a :: ()). a)’
Non-*-like kind when *-like expected: ()
when checking the body of forall: forall (a :: ()). a
*** Offending Program ***
Rec {
$trModule :: Module
[LclIdX]
$trModule = Module (TrNameS "main"#) (TrNameS "Bug"#)
wat :: KindOf (forall (a :: ()). a)
[LclIdX]
wat = ()
end Rec }
*** End of Offense ***
<no location info>: error:
Compilation had errors
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core Lint error with LiberalTypeSynonyms","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE LiberalTypeSynonyms #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# OPTIONS_GHC -dcore-lint #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ntype KindOf (a :: k) = k\r\n\r\nwat :: KindOf (forall (a :: ()). a)\r\nwat = ()\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.2/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Desugar (before optimization) ***\r\n<no location info>: warning:\r\n In the type ‘KindOf (forall (a :: ()). a)’\r\n Non-*-like kind when *-like expected: ()\r\n when checking the body of forall: forall (a :: ()). a\r\n*** Offending Program ***\r\nRec {\r\n$trModule :: Module\r\n[LclIdX]\r\n$trModule = Module (TrNameS \"main\"#) (TrNameS \"Bug\"#)\r\n\r\nwat :: KindOf (forall (a :: ()). a)\r\n[LclIdX]\r\nwat = ()\r\nend Rec }\r\n\r\n*** End of Offense ***\r\n\r\n\r\n<no location info>: error: \r\nCompilation had errors\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15928Improve error message: Reduction stack overflow when using "coerce"2024-01-21T16:25:19ZharendraImprove error message: Reduction stack overflow when using "coerce"EDIT: Executive summary: The error messages below are confusing and not perspicuous to users. We should fix. [ticket:15928\#comment:163956](https://gitlab.haskell.org//ghc/ghc/issues/15928#note_163956) has a concrete suggestion to use as...EDIT: Executive summary: The error messages below are confusing and not perspicuous to users. We should fix. [ticket:15928\#comment:163956](https://gitlab.haskell.org//ghc/ghc/issues/15928#note_163956) has a concrete suggestion to use as a starting point, and [ticket:15928\#comment:163991](https://gitlab.haskell.org//ghc/ghc/issues/15928#note_163991) suggests we print out the role signature of any tycons involved.
Compiling the following snippet results in a "Reduction stack overflow" error message:
```hs
{-# Language ScopedTypeVariables #-}
{-# Language RankNTypes #-}
import Data.Functor.Identity
import Data.Coerce
newtype Stream m a =
Stream {
unStream :: forall r. (Stream m a -> m r) -> m r
}
newtype SerialT m a = SerialT (Stream m a)
g :: SerialT Identity a -> Identity Bool
g m = undefined
idSerial :: SerialT Identity a -> SerialT Identity a
idSerial = id
f :: SerialT Identity a -> Identity Bool
f = g . idSerial . coerce
main = undefined
```
The following error message is produced on compiling this with ghc-8.6.2:
```
xy.hs:26:20: error:
• Reduction stack overflow; size = 201
When simplifying the following type:
Coercible
((Stream Identity a -> Identity r) -> Identity r)
((Stream Identity a0 -> Identity r) -> Identity r)
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the second argument of ‘(.)’, namely ‘coerce’
In the second argument of ‘(.)’, namely ‘idSerial . coerce’
In the expression: g . idSerial . coerce
|
26 | f = g . idSerial . coerce
| ^^^^^^
```
When I use an inline signature like this:
```hs
f :: SerialT Identity a -> Identity Bool
f = g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
main = undefined
```
It again results in the same error:
```
xy.hs:18:60: error:
• Reduction stack overflow; size = 201
When simplifying the following type:
Coercible
((Stream Identity a -> Identity r) -> Identity r)
((Stream Identity a0 -> Identity r) -> Identity r)
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the second argument of ‘(.)’, namely ‘coerce’
In the second argument of ‘(.)’, namely
‘(id :: SerialT Identity a -> SerialT Identity a) . coerce’
In the expression:
g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
|
18 | f = g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
| ^^^^^^
```
Everything works fine is I use an inline signature with a `forall` keyword like this:
```hs
f :: forall a. SerialT Identity a -> Identity Bool
f = g . (id :: SerialT Identity a -> SerialT Identity a) . coerce
```
I have following questions:
1) Why the first version results in a panic? Is that a bug?
2) The second version might possibly be incorrect code because the types do not unify, but still it should not result in a panic, because of the panic I could not figure out what the problem is. It took a long time to isolate the code and then do some trial and error on it.8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15745Panicking typechecker plugins2019-07-07T18:03:09ZPhil de JouxPanicking typechecker pluginsIf I use a typechecker plugin that fails then ghc panics and I'm asked to report a bug with GHC;
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Prelude.undefined
CallStack (from H...If I use a typechecker plugin that fails then ghc panics and I'm asked to report a bug with GHC;
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Prelude.undefined
CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at plugin/Undefined/Solve/Plugin.hs:14:39 in
undefined-solve-plugin-1.0.0.0-56evBabJYBHHTUlrE3HO5m:Undefined.Solve.Plugin
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Could we please say that it is the typechecker plugin that is panicking and ask for a bug report for the faulty typechecker, giving the issues URL for the plugin if we know it?
The following [undefined plugins](https://github.com/BlockScope/undefined-plugin) fail for init, solve and stop functions.
```haskell
module Undefined.Init.Plugin (plugin) where
import Plugins (Plugin(..), tcPlugin, defaultPlugin)
import TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))
import GHC.TcPluginM.Extra (tracePlugin)
plugin :: Plugin
plugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }
undefinedPlugin :: TcPlugin
undefinedPlugin = tracePlugin "undefined-init-plugin" $
TcPlugin
{ tcPluginInit = undefined
, tcPluginSolve = \_ _ _ _ -> return $ TcPluginOk [] []
, tcPluginStop = const $ return ()
}
```
```haskell
module Undefined.Solve.Plugin (plugin) where
import Plugins (Plugin(..), tcPlugin, defaultPlugin)
import TcRnTypes (TcPluginM, TcPluginResult, Ct, TcPlugin(..))
import GHC.TcPluginM.Extra (tracePlugin)
plugin :: Plugin
plugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }
undefinedPlugin :: TcPlugin
undefinedPlugin = tracePlugin "undefined-solve-plugin" $
TcPlugin
{ tcPluginInit = return ()
, tcPluginSolve = \_ _ _ _ -> undefined
, tcPluginStop = const $ return ()
}
```
```haskell
module Undefined.Stop.Plugin (plugin) where
import Plugins (Plugin(..), tcPlugin, defaultPlugin)
import TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))
import GHC.TcPluginM.Extra (tracePlugin)
plugin :: Plugin
plugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }
undefinedPlugin :: TcPlugin
undefinedPlugin = tracePlugin "undefined-stop-plugin" $
TcPlugin
{ tcPluginInit = return ()
, tcPluginSolve = \_ _ _ _ -> return $ TcPluginOk [] []
, tcPluginStop = const $ undefined
}
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.2.2 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panicking typechecker plugins","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"FeatureRequest","description":"If I use a typechecker plugin that fails then ghc panics and I'm asked to report a bug with GHC;\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-apple-darwin):\r\n \tPrelude.undefined\r\n CallStack (from HasCallStack):\r\n error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err\r\n undefined, called at plugin/Undefined/Solve/Plugin.hs:14:39 in\r\n undefined-solve-plugin-1.0.0.0-56evBabJYBHHTUlrE3HO5m:Undefined.Solve.Plugin\r\n\r\n Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nCould we please say that it is the typechecker plugin that is panicking and ask for a bug report for the faulty typechecker, giving the issues URL for the plugin if we know it?\r\n\r\nThe following [https://github.com/BlockScope/undefined-plugin undefined plugins] fail for init, solve and stop functions.\r\n\r\n{{{\r\n#!haskell\r\nmodule Undefined.Init.Plugin (plugin) where\r\n\r\nimport Plugins (Plugin(..), tcPlugin, defaultPlugin)\r\nimport TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))\r\nimport GHC.TcPluginM.Extra (tracePlugin)\r\n\r\nplugin :: Plugin\r\nplugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }\r\n\r\nundefinedPlugin :: TcPlugin\r\nundefinedPlugin = tracePlugin \"undefined-init-plugin\" $\r\n TcPlugin\r\n { tcPluginInit = undefined\r\n , tcPluginSolve = \\_ _ _ _ -> return $ TcPluginOk [] []\r\n , tcPluginStop = const $ return ()\r\n }\r\n}}}\r\n\r\n\r\n{{{\r\n#!haskell\r\nmodule Undefined.Solve.Plugin (plugin) where\r\n\r\nimport Plugins (Plugin(..), tcPlugin, defaultPlugin)\r\nimport TcRnTypes (TcPluginM, TcPluginResult, Ct, TcPlugin(..))\r\nimport GHC.TcPluginM.Extra (tracePlugin)\r\n\r\nplugin :: Plugin\r\nplugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }\r\n\r\nundefinedPlugin :: TcPlugin\r\nundefinedPlugin = tracePlugin \"undefined-solve-plugin\" $\r\n TcPlugin\r\n { tcPluginInit = return ()\r\n , tcPluginSolve = \\_ _ _ _ -> undefined\r\n , tcPluginStop = const $ return ()\r\n }\r\n}}}\r\n\r\n{{{\r\n#!haskell\r\nmodule Undefined.Stop.Plugin (plugin) where\r\n\r\nimport Plugins (Plugin(..), tcPlugin, defaultPlugin)\r\nimport TcRnTypes (TcPluginM, TcPluginResult(..), Ct, TcPlugin(..))\r\nimport GHC.TcPluginM.Extra (tracePlugin)\r\n\r\nplugin :: Plugin\r\nplugin = defaultPlugin { tcPlugin = const $ Just undefinedPlugin }\r\n\r\nundefinedPlugin :: TcPlugin\r\nundefinedPlugin = tracePlugin \"undefined-stop-plugin\" $\r\n TcPlugin\r\n { tcPluginInit = return ()\r\n , tcPluginSolve = \\_ _ _ _ -> return $ TcPluginOk [] []\r\n , tcPluginStop = const $ undefined\r\n }\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15516ghci: dynamic linking fails on osx2022-05-15T03:33:26Zkfizghci: dynamic linking fails on osx```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/vj/cm0c8jrs739_t411zdcx72240000gp/T/ghc24522_0/libghc_9.dylib, 5): Symbol not found: _Data...```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/vj/cm0c8jrs739_t411zdcx72240000gp/T/ghc24522_0/libghc_9.dylib, 5): Symbol not found: _DataziCsvUtils_rowBy_closure
Referenced from: /var/folders/vj/cm0c8jrs739_t411zdcx72240000gp/T/ghc24522_0/libghc_9.dylib
Expected in: flat namespace
in /var/folders/vj/cm0c8jrs739_t411zdcx72240000gp/T/ghc24522_0/libghc_9.dylib
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/14987Memory usage exploding for complex pattern matching2020-05-02T22:45:07ZvmiraldoMemory usage exploding for complex pattern matchingIt seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, [https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html](https://mail.haskell.org/pipermail/ghc-devs/2018-Marc...It seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, [https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html](https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html), the exhaustiveness checker could be the culprit.
We have tried with 7.10.3, 8.0.2, 8.4.1 and ghc-HEAD. They show similar results.
The "-fmax-pmchecker-iterations=0" option seems to help slightly. Bigger cases
will run out of memory even with the option enabled.
I'm attaching a "minimal" example to help diagnosing. The majority of the
code has been generated by Template Haskell.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Memory usage exploding for complex pattern matching","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"It seems like complex pattern matching is consuming a prohibitive amount of memory. From a discussion in ghc-devs, [https://mail.haskell.org/pipermail/ghc-devs/2018-March/015538.html], the exhaustiveness checker could be the culprit. \r\n\r\nWe have tried with 7.10.3, 8.0.2, 8.4.1 and ghc-HEAD. They show similar results.\r\n\r\nThe \"-fmax-pmchecker-iterations=0\" option seems to help slightly. Bigger cases\r\nwill run out of memory even with the option enabled.\r\n\r\nI'm attaching a \"minimal\" example to help diagnosing. The majority of the\r\ncode has been generated by Template Haskell.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14908Compiling using O1 works but panic using O2 or O32019-07-07T18:15:05ZjosejuanCompiling using O1 works but panic using O2 or O3<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure |...<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Compiling using O1 works but panic using O2 or O3","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14679The interpreter showed panic! (the 'impossible' happened)2019-07-07T18:16:02Zcrick_The interpreter showed panic! (the 'impossible' happened)My code -
```hs
{-
Example run:
Enter initial state:
12356 784
Enter final state:
123586 74
1 2 3
5 8 6
7 4
1 2 3
5 8 6
7 4
1 2 3
5 6
7 8 4
1 2 3
5 6
7 8 4
Minimum path length: 3
-}
import Data.List
import Data.List.Split
...My code -
```hs
{-
Example run:
Enter initial state:
12356 784
Enter final state:
123586 74
1 2 3
5 8 6
7 4
1 2 3
5 8 6
7 4
1 2 3
5 6
7 8 4
1 2 3
5 6
7 8 4
Minimum path length: 3
-}
import Data.List
import Data.List.Split
import Data.Map as Map hiding (map, filter)
swap :: Int -> Int -> State -> State
swap i j (State xs depth) = let (i', j') = if i > j then (j ,i) else (i, j)
left = take i' xs
middle = drop (i'+1) $ take j' xs
i_elem = xs !! i'
right = drop (j'+1) xs
j_elem = xs !! j'
xs' = left ++ [j_elem] ++ middle ++ [i_elem] ++ right
in (State xs' depth)
printGrid :: State -> IO()
printGrid (State xs depth) = let [x,y,z] = chunksOf 6 $ intersperse ' ' xs
in do putStrLn x
putStrLn y
putStrLn z
putStrLn ""
data State = State {
state :: [Char],
depth :: Int
} deriving (Eq, Show, Ord)
getMoves :: State -> [Char]
getMoves (State xs depth) = case ' ' `elemIndex` xs of
Nothing -> error "Empty block not found"
Just n -> let l = n `elem` [1,4,7,2,5,8]
r = n `elem` [0,3,6,1,4,7]
d = n `elem` [0..5]
u = n `elem` [3..8]
pairs = zip [l,r,d,u] ['L','R','D','U']
filtered = filter (\x -> fst x) pairs
in map snd filtered
next :: State -> [Char] -> [State]
next (State state depth) cs = case ' ' `elemIndex` state of
Nothing -> error "Empty block not found"
Just n -> do c <- cs
return $ case c of
'L' -> swap n (n-1) (State state (depth + 1))
'R' -> swap n (n+1) (State state (depth + 1))
'U' -> swap n (n-3) (State state (depth + 1))
'D' -> swap n (n+3) (State state (depth + 1))
test :: State -> State -> Bool
test state1 state2 = (state state1) == (state state2)
-- loop :: finalState -> open -> closed -> accmulated parentMap -> parentMap
loop :: State -> [State] -> [State] -> Map State State -> Maybe (State, Map State State)
loop final [] _ _ = Nothing
loop final open@(x:xs) closed parentMap = if test final x
then Just (x, parentMap)
else let moves = getMoves x
nextStates = next x moves
filter_fn = \x -> not (x `elem` open || x `elem` closed)
filtered = filter filter_fn nextStates
newMap = insertIntoMap filtered x parentMap
in loop final (xs ++ filtered) (x:closed) newMap
insertIntoMap :: [State] -> State -> Map State State -> Map State State
insertIntoMap [] _ parentMap = parentMap
insertIntoMap (x:xs) parent parentMap =
insertIntoMap xs parent (Map.insert x parent parentMap)
printAns :: State -> Map State State -> Int -> IO ()
printAns state parentMap count =
case Map.lookup state parentMap of
Just parent -> do printGrid parent
printAns parent parentMap (count + 1)
Nothing -> do putStrLn $ "Minimum path length: " ++ show count
return ()
ans :: Maybe (State, Map State State) -> IO ()
ans (Just (final, parentMap)) = do
printGrid final
printAns final parentMap 0
ans _ = putStrLn "No answer found."
main :: IO ()
main = do putStrLn "Enter initial state: "
start <- getLine
putStrLn "Enter final state: "
final <- getLine
ans $ loop (State final 0) [(State start 0)] [] Map.empty
```
Test Cases I entered in the order:
- Main\> main
Enter initial state:
123456 784
Enter final state:
1234567 8mianrrupted.
- Main\>
- Main\> main
Enter initial state:
12356 784
Enter final state:
123586 74
1 2 3
5 8 6
> 7 4
1 2 3
5 8 6
7 4
1 2 3
5 6
7 8 4
1 2 3
5 6
7 8 4
Minimum path length: 3
- Main\>
\<interactive\>: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-unknown-mingw32):
> thread blocked indefinitely in an MVar operation
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Windows |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"The interpreter showed panic! (the 'impossible' happened)","status":"New","operating_system":"Windows","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":["panic"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"My code - \r\n\r\n{{{#!hs\r\n{-\r\nExample run:\r\n\r\nEnter initial state:\r\n12356 784\r\nEnter final state:\r\n\r\n123586 74\r\n1 2 3\r\n5 8 6\r\n 7 4\r\n\r\n1 2 3\r\n5 8 6\r\n7 4\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\nMinimum path length: 3\r\n\r\n-}\r\n\r\nimport Data.List\r\nimport Data.List.Split\r\nimport Data.Map as Map hiding (map, filter)\r\n\r\nswap :: Int -> Int -> State -> State\r\nswap i j (State xs depth) = let (i', j') = if i > j then (j ,i) else (i, j)\r\n left = take i' xs\r\n middle = drop (i'+1) $ take j' xs\r\n i_elem = xs !! i'\r\n right = drop (j'+1) xs\r\n j_elem = xs !! j'\r\n xs' = left ++ [j_elem] ++ middle ++ [i_elem] ++ right\r\n in (State xs' depth)\r\n\r\nprintGrid :: State -> IO()\r\nprintGrid (State xs depth) = let [x,y,z] = chunksOf 6 $ intersperse ' ' xs\r\n in do putStrLn x\r\n putStrLn y\r\n putStrLn z\r\n putStrLn \"\"\r\n\r\ndata State = State {\r\n state :: [Char],\r\n depth :: Int\r\n} deriving (Eq, Show, Ord)\r\n\r\ngetMoves :: State -> [Char]\r\ngetMoves (State xs depth) = case ' ' `elemIndex` xs of\r\n Nothing -> error \"Empty block not found\"\r\n Just n -> let l = n `elem` [1,4,7,2,5,8]\r\n r = n `elem` [0,3,6,1,4,7]\r\n d = n `elem` [0..5]\r\n u = n `elem` [3..8]\r\n pairs = zip [l,r,d,u] ['L','R','D','U']\r\n filtered = filter (\\x -> fst x) pairs\r\n in map snd filtered\r\n\r\nnext :: State -> [Char] -> [State]\r\nnext (State state depth) cs = case ' ' `elemIndex` state of\r\n Nothing -> error \"Empty block not found\"\r\n Just n -> do c <- cs\r\n return $ case c of\r\n 'L' -> swap n (n-1) (State state (depth + 1))\r\n 'R' -> swap n (n+1) (State state (depth + 1))\r\n 'U' -> swap n (n-3) (State state (depth + 1))\r\n 'D' -> swap n (n+3) (State state (depth + 1))\r\n\r\ntest :: State -> State -> Bool\r\ntest state1 state2 = (state state1) == (state state2)\r\n\r\n-- loop :: finalState -> open -> closed -> accmulated parentMap -> parentMap\r\nloop :: State -> [State] -> [State] -> Map State State -> Maybe (State, Map State State)\r\nloop final [] _ _ = Nothing\r\nloop final open@(x:xs) closed parentMap = if test final x\r\n then Just (x, parentMap)\r\n else let moves = getMoves x\r\n nextStates = next x moves\r\n filter_fn = \\x -> not (x `elem` open || x `elem` closed)\r\n filtered = filter filter_fn nextStates\r\n newMap = insertIntoMap filtered x parentMap\r\n in loop final (xs ++ filtered) (x:closed) newMap\r\n\r\ninsertIntoMap :: [State] -> State -> Map State State -> Map State State\r\ninsertIntoMap [] _ parentMap = parentMap\r\ninsertIntoMap (x:xs) parent parentMap =\r\n insertIntoMap xs parent (Map.insert x parent parentMap)\r\n\r\nprintAns :: State -> Map State State -> Int -> IO ()\r\nprintAns state parentMap count =\r\n case Map.lookup state parentMap of\r\n Just parent -> do printGrid parent\r\n printAns parent parentMap (count + 1)\r\n Nothing -> do putStrLn $ \"Minimum path length: \" ++ show count\r\n return ()\r\n\r\nans :: Maybe (State, Map State State) -> IO ()\r\nans (Just (final, parentMap)) = do\r\n printGrid final\r\n printAns final parentMap 0\r\nans _ = putStrLn \"No answer found.\"\r\n\r\nmain :: IO ()\r\nmain = do putStrLn \"Enter initial state: \"\r\n start <- getLine\r\n putStrLn \"Enter final state: \"\r\n final <- getLine\r\n ans $ loop (State final 0) [(State start 0)] [] Map.empty\r\n\r\n}}}\r\n\r\nTest Cases I entered in the order:\r\n\r\n*Main> main\r\n\r\nEnter initial state:\r\n123456 784\r\n\r\nEnter final state:\r\n1234567 8mianrrupted.\r\n\r\n*Main>\r\n\r\n*Main> main\r\n\r\nEnter initial state:\r\n12356 784\r\n\r\nEnter final state:\r\n123586 74\r\n\r\n1 2 3\r\n5 8 6\r\n 7 4\r\n\r\n1 2 3\r\n5 8 6\r\n7 4\r\n\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\n1 2 3\r\n5 6\r\n7 8 4\r\n\r\n\r\nMinimum path length: 3\r\n*Main>\r\n<interactive>: panic! (the 'impossible' happened)\r\n (GHC version 8.0.1 for x86_64-unknown-mingw32):\r\n thread blocked indefinitely in an MVar operation\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug","type_of_failure":"OtherFailure","blocking":[]} -->