GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:20:31Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/13707xmobar crashes with segmentation faults?2019-07-07T18:20:31ZBen Gamarixmobar crashes with segmentation faults?Markus Trippelsdorf on `ghc-devs` reports that 8.2.1-rc2 produces crashing `xmobar` executables.
```
Program received signal SIGSEGV, Segmentation fault.
0x0000000000873aa8 in ghczmprim_GHCziClasses_eqChar_info ()
```
or:
```
Progra...Markus Trippelsdorf on `ghc-devs` reports that 8.2.1-rc2 produces crashing `xmobar` executables.
```
Program received signal SIGSEGV, Segmentation fault.
0x0000000000873aa8 in ghczmprim_GHCziClasses_eqChar_info ()
```
or:
```
Program received signal SIGSEGV, Segmentation fault.
0x0000000000873f98 in ghczmprim_GHCziClasses_zdfEqModulezuzdszdczeze_info ()
(gdb) bt
#0 0x0000000000873f98 in ghczmprim_GHCziClasses_zdfEqModulezuzdszdczeze_info ()
#1 0x0000000000000000 in ?? ()
```8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13585ala from Control.Lens.Wrapped panics2019-07-07T18:21:10ZFumiaki Kinoshitaala from Control.Lens.Wrapped panicsPanic.hs:
```
module Panic where
import Control.Lens.Wrapped
import Data.Monoid
foo :: Maybe String
foo = ala Last foldMap [Just "foo"]
```
main.hs:
```
module Main where
import Panic (foo)
main :: IO ()
main = print foo
```
```
$...Panic.hs:
```
module Panic where
import Control.Lens.Wrapped
import Data.Monoid
foo :: Maybe String
foo = ala Last foldMap [Just "foo"]
```
main.hs:
```
module Main where
import Panic (foo)
main :: IO ()
main = print foo
```
```
$ ghc -c -O2 Panic.hs
$ ghc -c -O2 main.hs
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.0.20170404 for x86_64-unknown-linux):
splitTyConApp
(Exchange (Unwrapped (Last String)) (Unwrapped (Last String)) |> <*
-> * -> *>_N) (Maybe
[Char]) ((Identity |> <*
-> *>_N) (Maybe
[Char]))
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1105:34 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The GHC version is 8134f7d4ba2c14b2f24d2f4c1f5260fcaff3304a.
Control.Lens.Wrapped is from the latest version of lens on GitHub: https://github.com/ekmett/lens/blob/9c4447de7ef57f67dbe293320d45bd8a546be522/src/Control/Lens/Wrapped.hs8.2.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/13458Panic with unsafeCoerce and -dcore-lint2019-07-07T18:21:46ZDavid FeuerPanic with unsafeCoerce and -dcore-lint```hs
{-# LANGUAGE MagicHash, TypeInType, ScopedTypeVariables #-}
module UIOST where
import GHC.Exts
import Data.Kind
import Unsafe.Coerce
unsafeCoerce' :: forall (r :: RuntimeRep)
(a :: TYPE r) (b :: TYPE r).
...```hs
{-# LANGUAGE MagicHash, TypeInType, ScopedTypeVariables #-}
module UIOST where
import GHC.Exts
import Data.Kind
import Unsafe.Coerce
unsafeCoerce' :: forall (r :: RuntimeRep)
(a :: TYPE r) (b :: TYPE r).
a -> b
unsafeCoerce' = unsafeCoerce id
```
Compiling this with optimization and `-dcore-lint` produces a panic:
```
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.1.20170308 for x86_64-unknown-linux):
runtimeRepPrimRep
typePrimRep (a_aW7 :: TYPE r_aW6)
r_aW6
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1191:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1195:37 in ghc:Outputable
pprPanic, called at compiler/simplStg/RepType.hs:360:5 in ghc:RepType
```
Using `unsafeCoerce# id` produces the panic without optimization. I have not been able to reproduce the problem without `-dcore-lint`.8.2.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/13411GCC driver fails on Windows 10 15019+2022-07-27T10:30:04ZTamar ChristinaGCC driver fails on Windows 10 15019+Our GCC driver seems to be failing with a compatibility error on Windows 10 Insider builds 15019+. Leaving error code 0xc0000142.
This driver has been unchanged since Windows XP and may just need some old APIs replaced.
<details><summa...Our GCC driver seems to be failing with a compatibility error on Windows 10 Insider builds 15019+. Leaving error code 0xc0000142.
This driver has been unchanged since Windows XP and may just need some old APIs replaced.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.0.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Driver |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GCC driver fails on Windows 10 15019+","status":"New","operating_system":"","component":"Driver","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Our GCC driver seems to be failing with a compatibility error on Windows 10 Insider builds 15019+. Leaving error code 0xc0000142.\r\n\r\nThis driver has been unchanged since Windows XP and may just need some old APIs replaced.","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1Tamar ChristinaTamar Christinahttps://gitlab.haskell.org/ghc/ghc/-/issues/13410GHC HEAD regression: Template variable unbound in rewrite rule2019-07-07T18:22:00ZRyan ScottGHC HEAD regression: Template variable unbound in rewrite rule`hybrid-vectors-0.2.1` currently fails to build with GHC HEAD. I've attached a minimized repro file with no dependencies (it's 410 lines long, since I had to copy-paste a lot of code from `vector` in order to reproduce this). The attache...`hybrid-vectors-0.2.1` currently fails to build with GHC HEAD. I've attached a minimized repro file with no dependencies (it's 410 lines long, since I had to copy-paste a lot of code from `vector` in order to reproduce this). The attached file builds on GHC 7.10.3 and 8.0.2, but fails on GHC HEAD with this panic:
```
$ ~/Software/ghc2/inplace/bin/ghc-stage2 -O2 -fforce-recomp Bug.hs
[1 of 1] Compiling Data.Vector.Hybrid.Internal ( Bug.hs, Bug.o )
Bug.hs:389:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘gmbasicOverlaps’, ‘gmbasicInitialize’, and ‘gmbasicUnsafeRead’
• In the instance declaration for ‘GMVector (MVector u v) (a, b)’
|
389 | instance (GMVector u a, GMVector v b) => GMVector (MVector u v) (a, b) where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:407:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘gbasicUnsafeFreeze’, ‘gbasicUnsafeThaw’, ‘gbasicLength’,
‘gbasicUnsafeSlice’, and ‘gbasicUnsafeIndexM’
• In the instance declaration for ‘GVector (Vector u v) (a, b)’
|
407 | instance (GVector u a, GVector v b) => GVector (Vector u v) (a, b) where
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.3.20170310 for x86_64-unknown-linux):
Template variable unbound in rewrite rule
Variable: sc_s8FV
Rule "SC:$j0"
Rule bndrs: [sc_s8FV, sc_s8FW, sc_s8FX, sg_s8FY, sc_s8FU]
LHS args: [sc_s8FU,
(MV
@ (GMutable u_a4oM)
@ (GMutable v_a4oO)
@ (PrimState (ST RealWorld))
@ (a_a4oN, b_a4oP)
@ a_a4oN
@ b_a4oP
@~ (<(a_a4oN, b_a4oP)>_N
:: ((a_a4oN, b_a4oP) :: *) ~# ((a_a4oN, b_a4oP) :: *))
sc_s8FW
sc_s8FX)
`cast` (sg_s8FY
:: (MVector
(GMutable u_a4oM)
(GMutable v_a4oO)
(PrimState (ST RealWorld))
(a_a4oN, b_a4oP) :: *)
~R#
(GMutable
(Vector u_a4oM v_a4oO) (PrimState (ST RealWorld)) c_a4oQ :: *))]
Actual args: [sc_s8FS,
wild_X3x
`cast` (Sub
(Sym (D:R:GMutableVector[0] <u_a4oM>_N <v_a4oO>_N)) <PrimState
(ST
RealWorld)>_N (Sym
cobox_a4Gz)
:: (MVector
(GMutable u_a4oM)
(GMutable v_a4oO)
(PrimState (ST RealWorld))
(a_a4oN, b_a4oP) :: *)
~R#
(GMutable
(Vector u_a4oM v_a4oO) (PrimState (ST RealWorld)) c_a4oQ :: *))]
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1191:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1195:37 in ghc:Outputable
pprPanic, called at compiler/specialise/Rules.hs:579:19 in ghc:Rules
```
Some important things to note:
- `-O2` is required to trigger this bug; using `-O1` or below works fine.
- The problematic code is the `Read (Vector u v c)` instance at the very bottom. In particular, commenting out the last line `readPrec = greadPrec` makes the panic go away.
- Moreover, there's a particular `INLINE` pragma in the `GMVector (MVector u v) (a, b)` instance that is critical to triggering the panic (it's on line 395; I've added a comment `Removing this INLINE pragma makes it compile` above it).8.2.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/13255aws package fails to build with master2019-07-07T18:22:43ZBen Gamariaws package fails to build with masterThe `aws` package from Hackage fails to build with `master`,
```
[22 of 76] Compiling Aws.DynamoDb.Core ( Aws/DynamoDb/Core.hs, /home/ben/code/mediawiki-annotate/dist-newstyle/build/x86_64-linux/ghc-8.1.20170209/aws-0.14.1/build/Aws/Dyn...The `aws` package from Hackage fails to build with `master`,
```
[22 of 76] Compiling Aws.DynamoDb.Core ( Aws/DynamoDb/Core.hs, /home/ben/code/mediawiki-annotate/dist-newstyle/build/x86_64-linux/ghc-8.1.20170209/aws-0.14.1/build/Aws/DynamoDb/Core.p_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.1.20170209 for x86_64-unknown-linux):
completeCall
$wloop_length_s18Cv
Stop[BoringCtxt] Int# -> Int# -> Int
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1188:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1192:37 in ghc:Outputable
pprPanic, called at compiler/simplCore/Simplify.hs:1598:9 in ghc:Simplify
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 | highest |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"aws package fails to build with master","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The `aws` package from Hackage fails to build with `master`,\r\n{{{\r\n[22 of 76] Compiling Aws.DynamoDb.Core ( Aws/DynamoDb/Core.hs, /home/ben/code/mediawiki-annotate/dist-newstyle/build/x86_64-linux/ghc-8.1.20170209/aws-0.14.1/build/Aws/DynamoDb/Core.p_o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.1.20170209 for x86_64-unknown-linux):\r\n\tcompleteCall\r\n $wloop_length_s18Cv\r\n Stop[BoringCtxt] Int# -> Int# -> Int\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1188:58 in ghc:Outputable\r\n callStackDoc, called at compiler/utils/Outputable.hs:1192:37 in ghc:Outputable\r\n pprPanic, called at compiler/simplCore/Simplify.hs:1598:9 in ghc:Simplify\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/12944ghc master (8.1.20161206) panics with assertion failure with devel2 flavor an...2019-07-07T18:24:31Zpacakghc master (8.1.20161206) panics with assertion failure with devel2 flavor and -Oghc version: 41ec722d71 with assertion that fails in #12926 commented out
```hs
{-# LANGUAGE TypeFamilies #-}
module Numeric.Polynomial.Log () where
class AdditiveGroup v where
(^+^) :: v -> v -> v
negateV :: v -> v
(^-^) :: v -...ghc version: 41ec722d71 with assertion that fails in #12926 commented out
```hs
{-# LANGUAGE TypeFamilies #-}
module Numeric.Polynomial.Log () where
class AdditiveGroup v where
(^+^) :: v -> v -> v
negateV :: v -> v
(^-^) :: v -> v -> v
v ^-^ v' = v ^+^ negateV v'
class AdditiveGroup v => VectorSpace v where
type Scalar v :: *
(*^) :: Scalar v -> v -> v
data Poly1 a = Poly1 a a
data IntOfLog poly a = IntOfLog !a !(poly a)
instance Num a => AdditiveGroup (Poly1 a) where
{-# INLINE (^+^) #-}
{-# INLINE negateV #-}
Poly1 a b ^+^ Poly1 a' b' = Poly1 (a + a') (b + b')
negateV (Poly1 a b) = Poly1 (negate a) (negate b)
instance (AdditiveGroup (poly a), Num a) => AdditiveGroup (IntOfLog poly a) where
{-# INLINE (^+^) #-}
{-# INLINE negateV #-}
IntOfLog k p ^+^ IntOfLog k' p' = IntOfLog (k + k') (p ^+^ p')
negateV (IntOfLog k p) = IntOfLog (negate k) (negateV p)
{-# SPECIALISE instance Num a => AdditiveGroup (IntOfLog Poly1 a) #-}
instance (VectorSpace (poly a), Scalar (poly a) ~ a, Num a) => VectorSpace (IntOfLog poly a) where
type Scalar (IntOfLog poly a) = a
s *^ IntOfLog k p = IntOfLog (s * k) (s *^ p)
```
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.1.20161206 for x86_64-unknown-linux):
ASSERT failed!
$dAdditiveGroup_aIU
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1114:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1163:22 in ghc:Outputable
assertPprPanic, called at compiler/stgSyn/CoreToStg.hs:967:78 in ghc:CoreToStg
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1114:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1118:37 in ghc:Outputable
pprPanic, called at compiler/utils/Outputable.hs:1161:5 in ghc:Outputable
assertPprPanic, called at compiler/stgSyn/CoreToStg.hs:967:78 in ghc:CoreToStg
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.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":"ghc master (8.1.20161206) panics with assertion failure with devel2 flavor and -O","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"ghc version: 41ec722d71 with assertion that fails in https://ghc.haskell.org/trac/ghc/ticket/12926 commented out\r\n\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\nmodule Numeric.Polynomial.Log () where\r\n\r\nclass AdditiveGroup v where\r\n (^+^) :: v -> v -> v\r\n negateV :: v -> v\r\n (^-^) :: v -> v -> v\r\n v ^-^ v' = v ^+^ negateV v'\r\n \r\nclass AdditiveGroup v => VectorSpace v where\r\n type Scalar v :: *\r\n (*^) :: Scalar v -> v -> v\r\n \r\n \r\ndata Poly1 a = Poly1 a a\r\n\r\ndata IntOfLog poly a = IntOfLog !a !(poly a)\r\n\r\ninstance Num a => AdditiveGroup (Poly1 a) where\r\n {-# INLINE (^+^) #-}\r\n {-# INLINE negateV #-}\r\n Poly1 a b ^+^ Poly1 a' b' = Poly1 (a + a') (b + b')\r\n negateV (Poly1 a b) = Poly1 (negate a) (negate b)\r\n \r\n \r\ninstance (AdditiveGroup (poly a), Num a) => AdditiveGroup (IntOfLog poly a) where\r\n {-# INLINE (^+^) #-}\r\n {-# INLINE negateV #-}\r\n IntOfLog k p ^+^ IntOfLog k' p' = IntOfLog (k + k') (p ^+^ p')\r\n negateV (IntOfLog k p) = IntOfLog (negate k) (negateV p)\r\n {-# SPECIALISE instance Num a => AdditiveGroup (IntOfLog Poly1 a) #-}\r\n \r\ninstance (VectorSpace (poly a), Scalar (poly a) ~ a, Num a) => VectorSpace (IntOfLog poly a) where\r\n type Scalar (IntOfLog poly a) = a\r\n s *^ IntOfLog k p = IntOfLog (s * k) (s *^ p)\r\n\r\n}}}\r\n\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.1.20161206 for x86_64-unknown-linux):\r\n ASSERT failed!\r\n $dAdditiveGroup_aIU\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1114:58 in ghc:Outputable\r\n callStackDoc, called at compiler/utils/Outputable.hs:1163:22 in ghc:Outputable\r\n assertPprPanic, called at compiler/stgSyn/CoreToStg.hs:967:78 in ghc:CoreToStg\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1114:58 in ghc:Outputable\r\n callStackDoc, called at compiler/utils/Outputable.hs:1118:37 in ghc:Outputable\r\n pprPanic, called at compiler/utils/Outputable.hs:1161:5 in ghc:Outputable\r\n assertPprPanic, called at compiler/stgSyn/CoreToStg.hs:967:78 in ghc:CoreToStg\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/12776Panic Simplifier ticks exhausted since ghc 82019-07-07T18:25:11ZsjcjoostenPanic Simplifier ticks exhausted since ghc 8I'm getting a panic! in GHC 8.0.1 and in 8.1.20161028
```
sjoosten:ghcCompileBug sjc$ ghc-8.1.20161028 --make Factorize.hs -O2
[1 of 2] Compiling Factorize ( Factorize.hs, Factorize.o )
ghc: panic! (the 'impossible' happened)
...I'm getting a panic! in GHC 8.0.1 and in 8.1.20161028
```
sjoosten:ghcCompileBug sjc$ ghc-8.1.20161028 --make Factorize.hs -O2
[1 of 2] Compiling Factorize ( Factorize.hs, Factorize.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.1.20161028 for x86_64-apple-darwin):
Simplifier ticks exhausted
When trying UnfoldingDone $slast_s_s1IU
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: 18241
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1076:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1080: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
```
Attached is some code which I tried to make as small as possible (it therefore does not make sense, but it reproduces the panic). The panic! only occurs with -O2 (I need the -O2 switch to optimise the automatically generated Haskell code).8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13984Panic when using a TH splice in a do bind pattern2019-07-07T18:19:01ZmbieleckPanic when using a TH splice in a do bind patternWhen compiling this file with HEAD (f656fba19d0cefe05643ddea35d080ea332a6584):
```hs
{-# LANGUAGE TemplateHaskell #-}
module Panic where
import Language.Haskell.TH
expr :: IO Exp
expr = runQ $ do
name <- newName "foo"
[| do $(varP...When compiling this file with HEAD (f656fba19d0cefe05643ddea35d080ea332a6584):
```hs
{-# LANGUAGE TemplateHaskell #-}
module Panic where
import Language.Haskell.TH
expr :: IO Exp
expr = runQ $ do
name <- newName "foo"
[| do $(varP name) <- pure (); pure () |]
```
I get this message:
```
[1 of 1] Compiling Panic ( Panic.hs, Panic.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.3.20170713 for x86_64-unknown-linux):
isIrrefutableHsPat:
$(varP name)
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/hsSyn/HsPat.hs:643:15 in ghc:HsPat
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
It compiles normally with GHC 8.2.1-rc2 (20170507). The bug exists in rc3 (20170704). I am unable to perform a more precise bisect.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.1-rc3 |
| 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":"Panic when using a TH splice in a do bind pattern","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc3","keywords":["panic","template-haskell"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When compiling this file with HEAD (f656fba19d0cefe05643ddea35d080ea332a6584):\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Panic where\r\n\r\nimport Language.Haskell.TH\r\n\r\nexpr :: IO Exp\r\nexpr = runQ $ do\r\n name <- newName \"foo\"\r\n [| do $(varP name) <- pure (); pure () |]\r\n\r\n}}}\r\n\r\nI get this message:\r\n\r\n{{{\r\n[1 of 1] Compiling Panic ( Panic.hs, Panic.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.3.20170713 for x86_64-unknown-linux):\r\n isIrrefutableHsPat:\r\n $(varP name)\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable\r\n callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable\r\n pprPanic, called at compiler/hsSyn/HsPat.hs:643:15 in ghc:HsPat\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nIt compiles normally with GHC 8.2.1-rc2 (20170507). The bug exists in rc3 (20170704). I am unable to perform a more precise bisect.","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13871GHC panic in 8.2 only: typeIsTypeable(Coercion)2019-07-07T18:19:45ZRyan ScottGHC panic in 8.2 only: typeIsTypeable(Coercion)This code works fine in GHC 8.0.1 and 8.0.2:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Foo where
import Data.Kind
data...This code works fine in GHC 8.0.1 and 8.0.2:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Foo where
import Data.Kind
data Foo (a :: Type) (b :: Type) where
MkFoo :: (a ~ Int, b ~ Char) => Foo a b
data family Sing (a :: k)
data SFoo (z :: Foo a b) where
SMkFoo :: SFoo MkFoo
```
But in GHC 8.2 and HEAD, it panics:
```
$ /opt/ghc/8.2.1/bin/ghci Bug.hs
GHCi, version 8.2.0.20170622: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Foo ( Bug.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.0.20170622 for x86_64-unknown-linux):
typeIsTypeable(Coercion)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.2.1-rc2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC panic in 8.2 only: typeIsTypeable(Coercion)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc2","keywords":["TypeInType,","Typeable"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This code works fine in GHC 8.0.1 and 8.0.2:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ConstraintKinds #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Foo where\r\n\r\nimport Data.Kind\r\n\r\ndata Foo (a :: Type) (b :: Type) where\r\n MkFoo :: (a ~ Int, b ~ Char) => Foo a b\r\n\r\ndata family Sing (a :: k)\r\ndata SFoo (z :: Foo a b) where\r\n SMkFoo :: SFoo MkFoo\r\n}}}\r\n\r\nBut in GHC 8.2 and HEAD, it panics:\r\n\r\n{{{\r\n$ /opt/ghc/8.2.1/bin/ghci Bug.hs\r\nGHCi, version 8.2.0.20170622: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Foo ( Bug.hs, interpreted )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.0.20170622 for x86_64-unknown-linux):\r\n\ttypeIsTypeable(Coercion)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/13782Bullish use of Template Haskell's newName causes GHC internal error2019-07-07T18:20:06ZRyan ScottBullish use of Template Haskell's newName causes GHC internal errorint-index originally spotted this bug at https://github.com/goldfirere/singletons/issues/150\#issuecomment-305909199. To reproduce, compile this file with GHC 8.0.1, 8.0.2, 8.2.1, or HEAD:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE E...int-index originally spotted this bug at https://github.com/goldfirere/singletons/issues/150\#issuecomment-305909199. To reproduce, compile this file with GHC 8.0.1, 8.0.2, 8.2.1, or HEAD:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Language.Haskell.TH
$(do TyConI (DataD _ _ [KindedTV a1 _] _ _ _) <- reify ''Maybe
[f,a2] <- mapM newName ["f","a"]
return [ SigD f (ForallT [KindedTV a2 (AppT (ConT ''Maybe) (VarT a1))]
[] (ConT ''Int))
, ValD (VarP f) (NormalB (LitE (IntegerL 42))) []
])
```
```
GHCi, version 8.2.0.20170522: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:9:3: error:
• GHC internal error: ‘a_11’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: []
• In the first argument of ‘Maybe’, namely ‘a_11’
In the kind ‘Maybe a_11’
In the type signature: f :: forall (a_a4Qz :: Maybe a_11). Int
|
9 | $(do TyConI (DataD _ _ [KindedTV a1 _] _ _ _) <- reify ''Maybe
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```
The root cause of the issue seems to be that the name `a` (which we picked for `newName`) happens to clash with the type variable we reified from `Maybe` (since `data Maybe a = ...`). If we pick a different name:
```hs
[f,a2] <- mapM newName ["f","albatross"]
```
Then it will compile.
This is a regression from GHC 7.10.3, as it compiles in that version (with a slight change to accommodate the API differences in `DataD` between 7.10.3 and 8.0):
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TemplateHaskell #-}
module Works where
import Language.Haskell.TH
$(do TyConI (DataD _ _ [KindedTV a1 _] _ _) <- reify ''Maybe
[f,a2] <- mapM newName ["f","a"]
return [ SigD f (ForallT [KindedTV a2 (AppT (ConT ''Maybe) (VarT a1))]
[] (ConT ''Int))
, ValD (VarP f) (NormalB (LitE (IntegerL 42))) []
])
```
```
$ /opt/ghc/7.10.3/bin/ghci Works.hs -ddump-splices
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Works ( Works.hs, interpreted )
Works.hs:(9,3)-(14,13): Splicing declarations
do { TyConI (DataD _ _ [KindedTV a1_a3jt _] _ _) <- reify ''Maybe;
[f_a3nh, a2_a3ni] <- mapM newName ["f", "a"];
return
[SigD
f_a3nh
(ForallT
[KindedTV a2_a3ni (AppT (ConT ''Maybe) (VarT a1_a3jt))]
[]
(ConT ''Int)),
ValD (VarP f_a3nh) (NormalB (LitE (IntegerL 42))) []] }
======>
f_a4vc :: forall (a_a4vd :: Maybe a_a4v3). Int
f_a4vc = 42
Ok, modules loaded: Works.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------------- |
| Version | 8.0.1 |
| Type | Bug |
| TypeOfFailure | ValidProgramRejected |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | int-index |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Bullish use of Template Haskell's newName causes GHC internal error","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["int-index"],"type":"Bug","description":"int-index originally spotted this bug at https://github.com/goldfirere/singletons/issues/150#issuecomment-305909199. To reproduce, compile this file with GHC 8.0.1, 8.0.2, 8.2.1, or HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE ExistentialQuantification #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Bug where\r\n\r\nimport Language.Haskell.TH\r\n\r\n$(do TyConI (DataD _ _ [KindedTV a1 _] _ _ _) <- reify ''Maybe\r\n [f,a2] <- mapM newName [\"f\",\"a\"]\r\n return [ SigD f (ForallT [KindedTV a2 (AppT (ConT ''Maybe) (VarT a1))]\r\n [] (ConT ''Int))\r\n , ValD (VarP f) (NormalB (LitE (IntegerL 42))) []\r\n ])\r\n}}}\r\n\r\n{{{\r\nGHCi, version 8.2.0.20170522: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug.hs, interpreted )\r\n\r\nBug.hs:9:3: error:\r\n • GHC internal error: ‘a_11’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: []\r\n • In the first argument of ‘Maybe’, namely ‘a_11’\r\n In the kind ‘Maybe a_11’\r\n In the type signature: f :: forall (a_a4Qz :: Maybe a_11). Int\r\n |\r\n9 | $(do TyConI (DataD _ _ [KindedTV a1 _] _ _ _) <- reify ''Maybe\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...\r\n}}}\r\n\r\nThe root cause of the issue seems to be that the name `a` (which we picked for `newName`) happens to clash with the type variable we reified from `Maybe` (since `data Maybe a = ...`). If we pick a different name:\r\n\r\n{{{#!hs\r\n [f,a2] <- mapM newName [\"f\",\"albatross\"]\r\n}}}\r\n\r\nThen it will compile.\r\n\r\nThis is a regression from GHC 7.10.3, as it compiles in that version (with a slight change to accommodate the API differences in `DataD` between 7.10.3 and 8.0):\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE ExistentialQuantification #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Works where\r\n\r\nimport Language.Haskell.TH\r\n\r\n$(do TyConI (DataD _ _ [KindedTV a1 _] _ _) <- reify ''Maybe\r\n [f,a2] <- mapM newName [\"f\",\"a\"]\r\n return [ SigD f (ForallT [KindedTV a2 (AppT (ConT ''Maybe) (VarT a1))]\r\n [] (ConT ''Int))\r\n , ValD (VarP f) (NormalB (LitE (IntegerL 42))) []\r\n ])\r\n}}}\r\n\r\n{{{\r\n$ /opt/ghc/7.10.3/bin/ghci Works.hs -ddump-splices\r\nGHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Works ( Works.hs, interpreted )\r\nWorks.hs:(9,3)-(14,13): Splicing declarations\r\n do { TyConI (DataD _ _ [KindedTV a1_a3jt _] _ _) <- reify ''Maybe;\r\n [f_a3nh, a2_a3ni] <- mapM newName [\"f\", \"a\"];\r\n return\r\n [SigD\r\n f_a3nh\r\n (ForallT\r\n [KindedTV a2_a3ni (AppT (ConT ''Maybe) (VarT a1_a3jt))]\r\n []\r\n (ConT ''Int)),\r\n ValD (VarP f_a3nh) (NormalB (LitE (IntegerL 42))) []] }\r\n ======>\r\n f_a4vc :: forall (a_a4vd :: Maybe a_a4v3). Int\r\n f_a4vc = 42\r\nOk, modules loaded: Works.\r\n}}}","type_of_failure":"ValidProgramRejected","blocking":[]} -->8.2.1carlostomecarlostomehttps://gitlab.haskell.org/ghc/ghc/-/issues/13479Core Lint issues during slowtest2019-07-07T18:21:41ZBen GamariCore Lint issues during slowtestI'm am seeing Core Lint failurse from the `T5626` test,
```
*** Core Lint errors : in result of Simplifier *** ...I'm am seeing Core Lint failurse from the `T5626` test,
```
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[RHS of go_s54c :: [Int] -> (Int, Int, Int, Int)]
idArity 2 exceeds typeArity 1: go_s54c
```
The relevant bits of the program are,
```hs
Rec {
go_s54c [Occ=LoopBreaker] :: [Int] -> (Int, Int, Int, Int)
[LclId,
Arity=2,
CallArity=2,
Str=<B,U>b,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=NEVER}]
go_s54c
= \ (ds_X35o :: [Int]) ->
case ds_X35o of {
[] -> case lvl_s4Vm of wild_00 { };
: y_a34y [Dmd=<B,A>] ys_a34z [Dmd=<B,U>] -> go_s54c ys_a34z
}
end Rec }
lvl_s54d :: (Int, Int, Int, Int)
[LclId,
Arity=1,
Str=x,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=NEVER}]
lvl_s54d = go_s54c ([] @ Int)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core Lint issues during slowtest","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I'm am seeing Core Lint failurse from the `T5626` test,\r\n{{{\r\n*** Core Lint errors : in result of Simplifier *** \r\n<no location info>: warning: \r\n [RHS of go_s54c :: [Int] -> (Int, Int, Int, Int)] \r\n idArity 2 exceeds typeArity 1: go_s54c \r\n}}}\r\nThe relevant bits of the program are,\r\n{{{#!hs\r\nRec { \r\ngo_s54c [Occ=LoopBreaker] :: [Int] -> (Int, Int, Int, Int) \r\n[LclId, \r\n Arity=2, \r\n CallArity=2, \r\n Str=<B,U>b, \r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, \r\n WorkFree=True, Expandable=True, Guidance=NEVER}] \r\ngo_s54c \r\n = \\ (ds_X35o :: [Int]) -> \r\n case ds_X35o of { \r\n [] -> case lvl_s4Vm of wild_00 { }; \r\n : y_a34y [Dmd=<B,A>] ys_a34z [Dmd=<B,U>] -> go_s54c ys_a34z\r\n } \r\nend Rec } \r\n\r\nlvl_s54d :: (Int, Int, Int, Int) \r\n[LclId, \r\n Arity=1, \r\n Str=x, \r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True, Guidance=NEVER}] \r\nlvl_s54d = go_s54c ([] @ Int) \r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1Joachim Breitnermail@joachim-breitner.deJoachim Breitnermail@joachim-breitner.dehttps://gitlab.haskell.org/ghc/ghc/-/issues/12396Panic when specializing in another module2019-07-07T18:26:47ZEric CrockettPanic when specializing in another moduleIn the attached example (which requires `criterion` and `deepseq`), when compiled with `ghc -O2 -funfolding-use-threshold1000 Main.hs`, I get the following error on `Main.hs`:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8...In the attached example (which requires `criterion` and `deepseq`), when compiled with `ghc -O2 -funfolding-use-threshold1000 Main.hs`, I get the following error on `Main.hs`:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-unknown-linux):
StgCmmEnv: variable not found
$d(%,%)_aaTF
local binds for:
$trModule
$sfool
$trModule1
$trModule2
$wlvl_rgY8
lvl_rgY9
lvl1_rgYa
lvl3_rgYc
lvl4_rgYd
lvl5_rgYe
lvl6_rgYf
lvl7_rgYg
lvl8_rgYh
lvl9_rgYi
lvl10_rgYj
lvl11_rgYk
lvl12_rgYl
lvl13_rgYm
lvl14_rgYn
lvl15_rgYo
lvl16_rgYp
lvl17_rgYq
lvl18_rgYr
lvl19_rgYs
lvl20_rgYt
lvl21_rgYu
lvl22_rgYv
lvl23_rgYw
lvl24_rgYx
lvl25_rgYy
lvl26_rgYz
lvl27_rgYA
lvl28_rgYB
lvl29_rgYC
lvl30_rgYD
lvl31_rgYE
lvl32_rgYF
lvl33_rgYG
lvl34_rgYH
lvl35_rgYI
lvl36_rgYJ
lvl37_rgYK
lvl38_rgYL
lvl39_rgYM
lvl40_rgYN
lvl41_rgYO
lvl42_rgYP
lvl43_rgYQ
lvl44_rgYR
lvl45_rgYS
lvl46_rgYT
lvl47_rgYU
lvl48_rgYV
lvl49_rgYW
lvl50_rgYX
lvl51_rgYY
lvl52_rgYZ
lvl53_rgZ0
lvl54_rgZ1
lvl55_rgZ2
lvl56_rgZ3
lvl57_rgZ4
lvl58_rgZ5
lvl59_rgZ6
lvl60_rgZ7
lvl61_rgZ8
lvl62_rgZ9
lvl63_rgZa
lvl64_rgZb
lvl65_rgZc
lvl66_rgZd
ww1_rgZe
ww2_rgZf
ww3_rgZg
ww4_rgZh
pinfo_rgZi
pinfo1_rgZj
pinfo2_rgZk
pinfo3_rgZl
lvl67_rgZm
lvl68_rgZn
lvl69_rgZo
$wgo12_rgZp
eta_sh1k
wild_sh1l
v_sh1m
sat_sh1n
```
I initially found this bug when I added a `SPECIALIZE` pragma for `fool` in `Main.hs`. However, I need `funfolding-use-threshold1000` and the constraint synonym `UCRTElt` in `Foo.hs` to trigger the bug. Every time I tried to remove `criterion`, the bug stopped triggering, though I seriously doubt that the bug is in `criterion`.8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/12104Type families, `TypeError`, and `-fdefer-type-errors` cause "opt_univ fell in...2019-07-07T18:27:38ZantalszType families, `TypeError`, and `-fdefer-type-errors` cause "opt_univ fell into a hole"If I create a type family – open or closed – with a case that evaluates to a `TypeError`, and define a top-level binding with this type, loading the file with `-fdefer-type-errors` enabled (or via `:load!`/`:reload!`) panics GHC with "op...If I create a type family – open or closed – with a case that evaluates to a `TypeError`, and define a top-level binding with this type, loading the file with `-fdefer-type-errors` enabled (or via `:load!`/`:reload!`) panics GHC with "opt_univ fell into a hole". (And if I used `:load!` or `:reload!`, `-fdefer-type-errors` doesn't get unset.)
A minimal example:
```hs
{-# LANGUAGE TypeFamilies, DataKinds, UndecidableInstances #-}
module T12104 where
import GHC.TypeLits
type family F a where
F a = TypeError (Text "error")
err :: F ()
err = ()
```
results in the panic
```
….hs:9:7: warning: [-Wdeferred-type-errors]
• error
• In the expression: ()
In an equation for ‘err’: err = ()
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.1 for x86_64-apple-darwin):
opt_univ fell into a hole {a4Va}
```
Adding more cases to the type family, or making it open, still cause the crash. This holds whether the error case is a final catch-all case, or something more like
```hs
type family F a where
F () = TypeError (Text "error")
F a = ()
```
Just using a type synonym for `F` doesn't cause a panic, however, and nor does giving `err` the type `TypeError (Text "error")` directly.8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/11784panic "hscCmmFile: no_mod" with `-v2 and above2019-07-07T18:28:33Zerikdpanic "hscCmmFile: no_mod" with `-v2 and aboveInitailly found this on powerpc when debugging #11773, but it also happens on x86_64. The command line:
```
inplace/bin/ghc-stage1 -static -H64m -O0 -Wall -v2 -Iincludes \
-Iincludes/dist -Iincludes/dist-derivedconstants/header \
...Initailly found this on powerpc when debugging #11773, but it also happens on x86_64. The command line:
```
inplace/bin/ghc-stage1 -static -H64m -O0 -Wall -v2 -Iincludes \
-Iincludes/dist -Iincludes/dist-derivedconstants/header \
-Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build \
-DCOMPILING_RTS -this-unit-id rts -optc-DNOSMP -dcmm-lint -i -irts \
-irts/dist/build -irts/dist/build/autogen -Irts/dist/build \
-Irts/dist/build/autogen -O2 -Wnoncanonical-monad-instances -c\
rts/StgStartup.cmm -o rts/dist/build/StgStartup.o
```
panics with a message:
```
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 8.1.20160402 for powerpc-unknown-linux):
hscCmmFile: no_mod
```
The only thing that was added to the command line that is different from the normal build command is the `-v2`.
This is caused by the code (in compiler/main/HscMain.hs):
```
no_mod = panic "hscCmmFile: no_mod"
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.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":"panic \"hscCmmFile: no_mod\" with `-v2 and above","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Initailly found this on powerpc when debugging #11773, but it also happens on x86_64. The command line:\r\n\r\n{{{\r\ninplace/bin/ghc-stage1 -static -H64m -O0 -Wall -v2 -Iincludes \\\r\n -Iincludes/dist -Iincludes/dist-derivedconstants/header \\\r\n -Iincludes/dist-ghcconstants/header -Irts -Irts/dist/build \\\r\n -DCOMPILING_RTS -this-unit-id rts -optc-DNOSMP -dcmm-lint -i -irts \\\r\n -irts/dist/build -irts/dist/build/autogen -Irts/dist/build \\\r\n -Irts/dist/build/autogen -O2 -Wnoncanonical-monad-instances -c\\\r\n rts/StgStartup.cmm -o rts/dist/build/StgStartup.o\r\n}}}\r\n\r\npanics with a message:\r\n\r\n{{{\r\nghc-stage1: panic! (the 'impossible' happened)\r\n (GHC version 8.1.20160402 for powerpc-unknown-linux):\r\n hscCmmFile: no_mod\r\n}}}\r\n\r\nThe only thing that was added to the command line that is different from the normal build command is the `-v2`.\r\n\r\nThis is caused by the code (in compiler/main/HscMain.hs):\r\n\r\n{{{\r\n no_mod = panic \"hscCmmFile: no_mod\"\r\n}}}\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/11532ghc: panic! occured2019-07-07T18:29:56Zcutsea110ghc: panic! occuredI'd like to try install by following:
```
$ cabal sandbox init
$ cabal install metadata
Resolving dependencies...
Notice: installing into a sandbox located at
/home/cutsea110/devel/haskell/sandbox/.cabal-sandbox
Configuring metadata-0.4...I'd like to try install by following:
```
$ cabal sandbox init
$ cabal install metadata
Resolving dependencies...
Notice: installing into a sandbox located at
/home/cutsea110/devel/haskell/sandbox/.cabal-sandbox
Configuring metadata-0.4.2.0...
Building metadata-0.4.2.0...
:
:
[1036 of 1286] Compiling Text.HTML5.MetaData.Schema.TelevisionStation[boot] ( Text/HTML5/MetaData/Schema/TelevisionStation.hs-boot, dist/dist-sandbox-304cb20a/build/Text/HTML5/MetaData/Schema/TelevisionStation.o-boot )
[1037 of 1286] Compiling Text.HTML5.MetaData.Schema.TelevisionStation ( Text/HTML5/MetaData/Schema/TelevisionStation.hs, dist/dist-sandbox-304cb20a/build/Text/HTML5/MetaData/Schema/TelevisionStation.o )
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.3 for x86_64-unknown-linux):
LocalReg's live-in to graph cpd3t {_sp8MJ::P64}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
cabal: Error: some packages failed to install:
metadata-0.4.2.0 failed during the building phase. The exception was:
ExitFailure 1
```
--
regards.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.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: panic! occured","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I'd like to try install by following:\r\n\r\n{{{\r\n$ cabal sandbox init\r\n$ cabal install metadata\r\nResolving dependencies...\r\nNotice: installing into a sandbox located at\r\n/home/cutsea110/devel/haskell/sandbox/.cabal-sandbox\r\nConfiguring metadata-0.4.2.0...\r\nBuilding metadata-0.4.2.0...\r\n:\r\n:\r\n\r\n[1036 of 1286] Compiling Text.HTML5.MetaData.Schema.TelevisionStation[boot] ( Text/HTML5/MetaData/Schema/TelevisionStation.hs-boot, dist/dist-sandbox-304cb20a/build/Text/HTML5/MetaData/Schema/TelevisionStation.o-boot )\r\n[1037 of 1286] Compiling Text.HTML5.MetaData.Schema.TelevisionStation ( Text/HTML5/MetaData/Schema/TelevisionStation.hs, dist/dist-sandbox-304cb20a/build/Text/HTML5/MetaData/Schema/TelevisionStation.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 7.10.3 for x86_64-unknown-linux):\r\n LocalReg's live-in to graph cpd3t {_sp8MJ::P64}\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\ncabal: Error: some packages failed to install:\r\nmetadata-0.4.2.0 failed during the building phase. The exception was:\r\nExitFailure 1\r\n\r\n}}}\r\n\r\n-- \r\n\r\nregards.","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1Andreas KlebingerAndreas Klebingerhttps://gitlab.haskell.org/ghc/ghc/-/issues/14102panic! (the 'impossible' happened)2019-07-07T18:18:27Zpmckelvypanic! (the 'impossible' happened)```
(GHC version 8.0.2 for x86_64-apple-darwin):
initTc: unsolved constraints
WC {wc_insol = [W] action_a1Ei :: t_a1Eh[tau:1] (CHoleCan: action)}
```
Code:
```hs
import Data.Char
import Data.List
data InvoiceStruct = InvoiceStruc...```
(GHC version 8.0.2 for x86_64-apple-darwin):
initTc: unsolved constraints
WC {wc_insol = [W] action_a1Ei :: t_a1Eh[tau:1] (CHoleCan: action)}
```
Code:
```hs
import Data.Char
import Data.List
data InvoiceStruct = InvoiceStruct
{ total :: Int
, shippedItemCount :: Int
} deriving (Show)
invoice :: InvoiceStruct -> String -> Int -> InvoiceStruct
invoice i comp val = (action) i[total] val
```8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/14028ghc panic: -fexternal-interpreter + .o + QuasiQuotes?2021-04-21T06:45:52Zblynnghc panic: -fexternal-interpreter + .o + QuasiQuotes?1. Compile an object file with -fPIC, e.g:
```
cat > hello.c << EOF
#include <stdio.h>
void hi(){puts("Hello, World!");}
EOF
gcc -c -fPIC hello.c
```
1. Write Haskell that uses QuasiQuotes, e.g:
```
cat > h.hs << EOF
{-# LANGUAGE Quas...1. Compile an object file with -fPIC, e.g:
```
cat > hello.c << EOF
#include <stdio.h>
void hi(){puts("Hello, World!");}
EOF
gcc -c -fPIC hello.c
```
1. Write Haskell that uses QuasiQuotes, e.g:
```
cat > h.hs << EOF
{-# LANGUAGE QuasiQuotes #-}
import Text.Heredoc (here)
s :: String
s = [here|goes nothing|]
EOF
```
1. Compile with -fexternal-interpreter:
```
cabal install heredoc
ghc -fexternal-interpreter h.hs hello.o
```
I saw:
\[1 of 1\] Compiling Main ( h.hs, h.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
> Loading temp shared object failed: /home/blynn/.local/lib/ghc-8.0.2/ghc-prim-0.5.0.0/libHSghc-prim-0.5.0.0-ghc8.0.2.so: undefined symbol: stg_thawArrayzh
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
<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":"ghc panic: -fexternal-interpreter + .o + QuasiQuotes?","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":["ghc","impossible","panic"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"1. Compile an object file with -fPIC, e.g:\r\n\r\n{{{\r\ncat > hello.c << EOF\r\n#include <stdio.h>\r\nvoid hi(){puts(\"Hello, World!\");}\r\nEOF\r\ngcc -c -fPIC hello.c\r\n}}}\r\n\r\n2. Write Haskell that uses QuasiQuotes, e.g:\r\n\r\n{{{\r\ncat > h.hs << EOF\r\n{-# LANGUAGE QuasiQuotes #-}\r\nimport Text.Heredoc (here)\r\ns :: String\r\ns = [here|goes nothing|]\r\nEOF\r\n}}}\r\n\r\n3. Compile with -fexternal-interpreter:\r\n\r\n{{{\r\ncabal install heredoc\r\nghc -fexternal-interpreter h.hs hello.o\r\n}}}\r\n\r\nI saw:\r\n\r\n[1 of 1] Compiling Main ( h.hs, h.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.0.2 for x86_64-unknown-linux):\r\n Loading temp shared object failed: /home/blynn/.local/lib/ghc-8.0.2/ghc-prim-0.5.0.0/libHSghc-prim-0.5.0.0-ghc8.0.2.so: undefined symbol: stg_thawArrayzh\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13880panic initTc: unsolved constraints2020-01-24T17:00:52Zvantopanic initTc: unsolved constraintsI'm trying to play with some piece of code in GHCi. Sorry if it's a duplicate bug.\\\\
```hs
{-# LANGUAGE TemplateHaskell #-}
module Testbar where
printf :: String -> String
printf s = gen (parse s)
$(printf "Error: %s at line %d")
...I'm trying to play with some piece of code in GHCi. Sorry if it's a duplicate bug.\\\\
```hs
{-# LANGUAGE TemplateHaskell #-}
module Testbar where
printf :: String -> String
printf s = gen (parse s)
$(printf "Error: %s at line %d")
```
```
Prelude> :l testbar
[1 of 1] Compiling Testbar ( testbar.hs, interpreted )
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.0.2 for i386-unknown-mingw32):
initTc: unsolved constraints
WC {wc_insol =
[W] gen_a10Q :: t_a10P[tau:1] (CHoleCan: gen)
[W] parse_a10Z :: t_a10Y[tau:1] (CHoleCan: parse)}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```8.2.1https://gitlab.haskell.org/ghc/ghc/-/issues/13850Incorrect function signature causes the impossible to happen2019-07-07T18:19:50ZerikdIncorrect function signature causes the impossible to happenI made a mistake in my function signature:
```
> cat wibble.hs
ecase :: Either a b -> (a -> c) (b -> c) -> c
ecase (Left a) f _ = f a
ecase (Right b) _ g = g b
> ghci wibble.hs
GHCi, version 8.2.0.20170507: http://www.haskell.org/ghc...I made a mistake in my function signature:
```
> cat wibble.hs
ecase :: Either a b -> (a -> c) (b -> c) -> c
ecase (Left a) f _ = f a
ecase (Right b) _ g = g b
> ghci wibble.hs
GHCi, version 8.2.0.20170507: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/erikd/.ghci
[1 of 1] Compiling Main ( wibble.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.0.20170507 for x86_64-unknown-linux): repSplitAppTys
a_a1pA[sk:1]
c_a1pC[sk:1]
[]
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in
ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in
ghc:Outputable
pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type
```
GHC 8.02 correctly reports an error:
```
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/erikd/.ghci
[1 of 1] Compiling Main ( wibble.hs, interpreted )
wibble.hs:1:24: error:
• Expecting one fewer argument to ‘a -> c’
Expected kind ‘* -> *’, but ‘a -> c’ has kind ‘*’
• In the type signature:
ecase :: Either a b -> (a -> c) (b -> c) -> c
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.1-rc2 |
| 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":"Incorrect function signature causes the impossible to happen","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.2.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I made a mistake in my function signature:\r\n{{{\r\n> cat wibble.hs \r\necase :: Either a b -> (a -> c) (b -> c) -> c\r\necase (Left a) f _ = f a\r\necase (Right b) _ g = g b\r\n\r\n> ghci wibble.hs \r\nGHCi, version 8.2.0.20170507: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/erikd/.ghci\r\n[1 of 1] Compiling Main ( wibble.hs, interpreted )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.0.20170507 for x86_64-unknown-linux): repSplitAppTys\r\n a_a1pA[sk:1]\r\n c_a1pC[sk:1]\r\n []\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in \r\n ghc:Outputable\r\n callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in \r\n ghc:Outputable\r\n pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type\r\n}}}\r\n\r\nGHC 8.02 correctly reports an error:\r\n{{{\r\nGHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/erikd/.ghci\r\n[1 of 1] Compiling Main ( wibble.hs, interpreted )\r\n\r\nwibble.hs:1:24: error:\r\n • Expecting one fewer argument to ‘a -> c’\r\n Expected kind ‘* -> *’, but ‘a -> c’ has kind ‘*’\r\n • In the type signature:\r\n ecase :: Either a b -> (a -> c) (b -> c) -> c\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.2.1