GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:16:09Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/14650Panic with no extensions (StgCmmEnv: variable not found)2019-07-07T18:16:09ZZemylaPanic with no extensions (StgCmmEnv: variable not found)When I compile the attached Haskell program with `-O2`, or `-O1` with `-fspec-constr` added, I get a compiler panic:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-mingw32):
StgCmmEnv: variab...When I compile the attached Haskell program with `-O2`, or `-O1` with `-fspec-constr` added, I get a compiler panic:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-mingw32):
StgCmmEnv: variable not found
$smergeSplit_s3bq
local binds for:
$WLL
$W:%
$W:&
cmp_s3ox
eta_s3oy
$wmergeLL_s3oz
$s$wpush_s3pZ
$wpush_s3q0
$s$wmergeAll_s3rl
$wmergeAll_s3rR
$wsplitDesc_s3sp
$wsplitAsc_s3sC
mergeSplit_s3tt
ss_s3tu
ds_s3tv
wild_s3tw
a1_s3tC
as'_s3tD
wild1_s3tE
b_s3tF
bs_s3tG
wild2_s3tH
ww1_s3tJ
ww2_s3tK
ww3_s3tL
ww4_s3tM
ww6_s3tO
ww7_s3tP
ww8_s3tQ
ww9_s3tR
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\codeGen\StgCmmEnv.hs:147:9 in ghc:StgCmmEnv
```
I ran it with `-dcore-lint`, and it gives the following messages (full .lint attached):
```
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
In the expression: jump $smergeSplit_s3bN
ww_s34F ww_s34Q ww_s34R ww_s34S ww_s34T
$smergeSplit_s3bN [Occ=LoopBreaker]
:: [a_a23n] -> Int# -> Bool -> [a_a23n] -> Stack a_a23n -> [a_a23n]
[LclId[JoinId(5)],
Arity=5,
Str=<S,U><L,U><L,U><L,U><L,U>,
Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=IF_ARGS [80 0 0 0 0] 554 0}] is out of scope
<no location info>: warning:
In the expression: jump $smergeSplit_s3bN
ww_s34F ww_s34Q ww_s34R ww_s34S ww_s34T
Invalid occurrence of a join variable: $smergeSplit_s3bN
The binder is either not a join point, or not valid here
<no location info>: warning:
In the expression: jump $smergeSplit_s3bN
ww_s34K ww_s34Q ww_s34R ww_s34S ww_s34T
$smergeSplit_s3bN [Occ=LoopBreaker]
:: [a_a23n] -> Int# -> Bool -> [a_a23n] -> Stack a_a23n -> [a_a23n]
[LclId[JoinId(5)],
Arity=5,
Str=<S,U><L,U><L,U><L,U><L,U>,
Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=IF_ARGS [80 0 0 0 0] 554 0}] is out of scope
<no location info>: warning:
In the expression: jump $smergeSplit_s3bN
ww_s34K ww_s34Q ww_s34R ww_s34S ww_s34T
Invalid occurrence of a join variable: $smergeSplit_s3bN
The binder is either not a join point, or not valid here
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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":"Panic with no extensions (StgCmmEnv: variable not found)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When I compile the attached Haskell program with `-O2`, or `-O1` with `-fspec-constr` added, I get a compiler panic:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-mingw32):\r\n StgCmmEnv: variable not found\r\n $smergeSplit_s3bq\r\n local binds for:\r\n $WLL\r\n $W:%\r\n $W:&\r\n cmp_s3ox\r\n eta_s3oy\r\n $wmergeLL_s3oz\r\n $s$wpush_s3pZ\r\n $wpush_s3q0\r\n $s$wmergeAll_s3rl\r\n $wmergeAll_s3rR\r\n $wsplitDesc_s3sp\r\n $wsplitAsc_s3sC\r\n mergeSplit_s3tt\r\n ss_s3tu\r\n ds_s3tv\r\n wild_s3tw\r\n a1_s3tC\r\n as'_s3tD\r\n wild1_s3tE\r\n b_s3tF\r\n bs_s3tG\r\n wild2_s3tH\r\n ww1_s3tJ\r\n ww2_s3tK\r\n ww3_s3tL\r\n ww4_s3tM\r\n ww6_s3tO\r\n ww7_s3tP\r\n ww8_s3tQ\r\n ww9_s3tR\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\\codeGen\\StgCmmEnv.hs:147:9 in ghc:StgCmmEnv\r\n}}}\r\n\r\nI ran it with `-dcore-lint`, and it gives the following messages (full .lint attached):\r\n\r\n{{{\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n In the expression: jump $smergeSplit_s3bN\r\n ww_s34F ww_s34Q ww_s34R ww_s34S ww_s34T\r\n $smergeSplit_s3bN [Occ=LoopBreaker]\r\n :: [a_a23n] -> Int# -> Bool -> [a_a23n] -> Stack a_a23n -> [a_a23n]\r\n [LclId[JoinId(5)],\r\n Arity=5,\r\n Str=<S,U><L,U><L,U><L,U><L,U>,\r\n Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True,\r\n Guidance=IF_ARGS [80 0 0 0 0] 554 0}] is out of scope\r\n<no location info>: warning:\r\n In the expression: jump $smergeSplit_s3bN\r\n ww_s34F ww_s34Q ww_s34R ww_s34S ww_s34T\r\n Invalid occurrence of a join variable: $smergeSplit_s3bN\r\n The binder is either not a join point, or not valid here\r\n<no location info>: warning:\r\n In the expression: jump $smergeSplit_s3bN\r\n ww_s34K ww_s34Q ww_s34R ww_s34S ww_s34T\r\n $smergeSplit_s3bN [Occ=LoopBreaker]\r\n :: [a_a23n] -> Int# -> Bool -> [a_a23n] -> Stack a_a23n -> [a_a23n]\r\n [LclId[JoinId(5)],\r\n Arity=5,\r\n Str=<S,U><L,U><L,U><L,U><L,U>,\r\n Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True,\r\n Guidance=IF_ARGS [80 0 0 0 0] 554 0}] is out of scope\r\n<no location info>: warning:\r\n In the expression: jump $smergeSplit_s3bN\r\n ww_s34K ww_s34Q ww_s34R ww_s34S ww_s34T\r\n Invalid occurrence of a join variable: $smergeSplit_s3bN\r\n The binder is either not a join point, or not valid here\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/14652Allow different executable names on windows2019-07-07T18:16:09ZAndreas KlebingerAllow different executable names on windowsCurrently renaming the executable on windows leads to a ghc panic is it enforces that they are named ghc/ghc-stage\[123\].
This isn't enforced Linux and I don't see a good reason why we should do so on Windows.
<details><summary>Trac m...Currently renaming the executable on windows leads to a ghc panic is it enforces that they are named ghc/ghc-stage\[123\].
This isn't enforced Linux and I don't see a good reason why we should do so on Windows.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Allow different executable names on windows","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.4.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Task","description":"Currently renaming the executable on windows leads to a ghc panic is it enforces that they are named ghc/ghc-stage[123].\r\n\r\nThis isn't enforced Linux and I don't see a good reason why we should do so on Windows.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1Andreas KlebingerAndreas Klebingerhttps://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":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14680GHC 8.4.1-alpha panics when optimizing function using getTag and tagToEnum#2019-07-07T18:16:02ZRyan ScottGHC 8.4.1-alpha panics when optimizing function using getTag and tagToEnum#I originally observed this panic in [this Travis build](https://travis-ci.org/haskell-compat/deriving-compat/jobs/329948624#L804). The panic can be reduced to this file:
```hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeFamilies #-}
mod...I originally observed this panic in [this Travis build](https://travis-ci.org/haskell-compat/deriving-compat/jobs/329948624#L804). The panic can be reduced to this file:
```hs
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import GHC.Base (getTag)
import GHC.Exts (Int(..), tagToEnum#)
data family TyFamilyEnum
data instance TyFamilyEnum = TyFamilyEnum1 | TyFamilyEnum2 | TyFamilyEnum3
suc :: TyFamilyEnum -> TyFamilyEnum
suc a_aaf8
= case getTag a_aaf8 of
a_aaf9
-> if 2 == I# a_aaf9
then error "succ{TyFamilyEnum}: tried to take `succ' of last tag in enumeration"
else case I# a_aaf9 + 1 of
I# i_aafa -> tagToEnum# i_aafa :: TyFamilyEnum
```
In GHC 8.2.2, compiling this with optimization works fine. But in GHC 8.4.1-alpha, it panics:
```
$ /opt/ghc/8.4.1/bin/ghc -fforce-recomp -O1 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.0.20171222 for x86_64-unknown-linux):
Prelude.!!: index too large
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.1-alpha1 |
| 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":"GHC 8.4.1-alpha panics when optimizing function using getTag and tagToEnum#","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.4.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1-alpha1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I originally observed this panic in [https://travis-ci.org/haskell-compat/deriving-compat/jobs/329948624#L804 this Travis build]. The panic can be reduced to this file:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE MagicHash #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\nmodule Bug where\r\n\r\nimport GHC.Base (getTag)\r\nimport GHC.Exts (Int(..), tagToEnum#)\r\n\r\ndata family TyFamilyEnum\r\ndata instance TyFamilyEnum = TyFamilyEnum1 | TyFamilyEnum2 | TyFamilyEnum3\r\n\r\nsuc :: TyFamilyEnum -> TyFamilyEnum\r\nsuc a_aaf8\r\n = case getTag a_aaf8 of\r\n a_aaf9\r\n -> if 2 == I# a_aaf9\r\n then error \"succ{TyFamilyEnum}: tried to take `succ' of last tag in enumeration\"\r\n else case I# a_aaf9 + 1 of\r\n I# i_aafa -> tagToEnum# i_aafa :: TyFamilyEnum\r\n}}}\r\n\r\nIn GHC 8.2.2, compiling this with optimization works fine. But in GHC 8.4.1-alpha, it panics:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.1/bin/ghc -fforce-recomp -O1 Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.0.20171222 for x86_64-unknown-linux):\r\n Prelude.!!: index too large\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/14708GHC panics when linking with an archive and using an annotation2019-07-07T18:15:56ZtchajedGHC panics when linking with an archive and using an annotationGHC panics when compiling code with an annotation and linking with an archive (a `.a` file). I think this is the same as #9438, but I have a really simple test case consisting of the following two files:
```c
// add.c
int add2(int x, in...GHC panics when compiling code with an annotation and linking with an archive (a `.a` file). I think this is the same as #9438, but I have a really simple test case consisting of the following two files:
```c
// add.c
int add2(int x, int y) { return x + y; }
```
```hs
-- app.hs
{-# ANN module () #-}
main :: IO ()
main = return ()
```
First I make an archive:
```
$ gcc -c add.c -o add.o
$ ar libadd.a add.o
```
And then the following fails:
```
$ ghc -ladd -L. app.hs
[1 of 1] Compiling Main ( app.hs, app.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-apple-darwin):
Loading archives not supported
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
make: *** [app] Error 1
```
The attached tar.gz has these source files and a Makefile to run the above. I've tested it on OS X 10.11 and Linux, both with GHC 8.2.2, and the behavior is the same.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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 panics when linking with an archive and using an annotation","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"GHC panics when compiling code with an annotation and linking with an archive (a `.a` file). I think this is the same as #9438, but I have a really simple test case consisting of the following two files:\r\n\r\n{{{#!c\r\n// add.c\r\nint add2(int x, int y) { return x + y; }\r\n}}}\r\n\r\n{{{#!hs\r\n-- app.hs\r\n{-# ANN module () #-}\r\n\r\nmain :: IO ()\r\nmain = return ()\r\n}}}\r\n\r\nFirst I make an archive:\r\n{{{\r\n$ gcc -c add.c -o add.o\r\n$ ar libadd.a add.o\r\n}}}\r\n\r\nAnd then the following fails:\r\n{{{\r\n$ ghc -ladd -L. app.hs\r\n[1 of 1] Compiling Main ( app.hs, app.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-apple-darwin):\r\n\tLoading archives not supported\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\nmake: *** [app] Error 1\r\n}}}\r\n\r\nThe attached tar.gz has these source files and a Makefile to run the above. I've tested it on OS X 10.11 and Linux, both with GHC 8.2.2, and the behavior is the same.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14765Levity polymorphism panic2021-07-25T17:30:54ZDavid FeuerLevity polymorphism panicI imagine I have made a mistake, but GHC shouldn't panic!
```hs
{-# language TypeInType, ScopedTypeVariables, MagicHash #-}
import GHC.Exts (TYPE, Proxy#, proxy#)
fold :: forall rep a (r :: TYPE rep).
(r -> a -> Proxy# r -> ...I imagine I have made a mistake, but GHC shouldn't panic!
```hs
{-# language TypeInType, ScopedTypeVariables, MagicHash #-}
import GHC.Exts (TYPE, Proxy#, proxy#)
fold :: forall rep a (r :: TYPE rep).
(r -> a -> Proxy# r -> r) -> (Proxy# r -> r) -> [a] -> r
fold f k [] = k proxy#
fold f k (x : xs) = fold f (f (k proxy#) x) xs
```
This gives me
```
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.5.20171211 for x86_64-unknown-linux):
splitFunTy
()
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:921:30 in ghc:Type
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.5 |
| 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":"Levity polymorphism panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I imagine I have made a mistake, but GHC shouldn't panic!\r\n\r\n{{{#!hs\r\n{-# language TypeInType, ScopedTypeVariables, MagicHash #-}\r\n\r\nimport GHC.Exts (TYPE, Proxy#, proxy#)\r\n\r\nfold :: forall rep a (r :: TYPE rep).\r\n (r -> a -> Proxy# r -> r) -> (Proxy# r -> r) -> [a] -> r\r\nfold f k [] = k proxy#\r\nfold f k (x : xs) = fold f (f (k proxy#) x) xs\r\n}}}\r\n\r\nThis gives me\r\n\r\n{{{\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20171211 for x86_64-unknown-linux):\r\n splitFunTy\r\n ()\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/types/Type.hs:921:30 in ghc:Type\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14777panic when using a function defined in terms of `error`2021-07-05T13:30:54ZZilin Chenzilin.chen@data61.csiro.aupanic when using a function defined in terms of `error`The error message I got from GHC was:
```
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
idInfo
t_XG0J
Call stack:
CallStack (from HasCallStack):
...The error message I got from GHC was:
```
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
idInfo
t_XG0J
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/basicTypes/Var.hs:526:34 in ghc:Var
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
How was it triggerred (in short):
There's function definition, `f x = undefined`. If I change it to `f x = __impossible "Oops!"`, ghc crashes. If I change it to `f x = error "Oops!"`, it's OK. The definition of `__impossible` is simply `__impossible s = error $ s ++ "some text"`.
The code can be found here: https://github.com/NICTA/cogent/blob/9420861128a8c445138aa6a48c62140d8c5f72eb/cogent/src/Cogent/Desugar.hs\#L482 and https://github.com/NICTA/cogent/blob/9420861128a8c445138aa6a48c62140d8c5f72eb/cogent/src/Cogent/Compiler.hs\#L30
It seems that this bug is not limited to 8.2.2; it also happened in 8.2.1.
I'm happy to provide more information, if someone can advice me what is needed. I'll also try to shrink it to a small test case.8.6.1Simon Peyton JonesSimon Peyton Joneshttps://gitlab.haskell.org/ghc/ghc/-/issues/14779Compiling with -g fails -lint-core checks2019-07-07T18:15:39ZniteriaCompiling with -g fails -lint-core checksCompiling the attached file produces:
```
$ inplace/bin/ghc-stage2 -O -dcore-lint -g -c Data.Fixed.hs
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[RHS of str_s2UI :: Addr#]
The type of this bi...Compiling the attached file produces:
```
$ inplace/bin/ghc-stage2 -O -dcore-lint -g -c Data.Fixed.hs
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[RHS of str_s2UI :: Addr#]
The type of this binder is unlifted: str_s2UI
Binder's type: Addr#
*** Offending Program ***
...
str_s2UI :: Addr#
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
str_s2UI = src<Data.Fixed.hs:78:31-39> "MkFixed"#
str_a2j4 :: String
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=False, Value=False, ConLike=True,
WorkFree=False, Expandable=True, Guidance=IF_ARGS [] 20 0}]
str_a2j4 = src<Data.Fixed.hs:78:31-39> unpackCString# str_s2UI
...
```
This came up when I wanted to compile GHC HEAD with `-g`.
There are a couple of related tickets, but some of them didn't reproduce. This is a small, self-contained example.
I'm hoping that it would be possible to solve this without fully solving #14123 which seems to have bigger scope.
My HEAD is d2511e3b61563ed3fc2c9aec2c90a4156373a24c.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------------------- |
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Debugging) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | bgamari, simonmar, simonpj |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Compiling with -g fails -lint-core checks","status":"New","operating_system":"","component":"Compiler (Debugging)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["bgamari","simonmar","simonpj"],"type":"Bug","description":"Compiling the attached file produces:\r\n{{{\r\n$ inplace/bin/ghc-stage2 -O -dcore-lint -g -c Data.Fixed.hs\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n [RHS of str_s2UI :: Addr#]\r\n The type of this binder is unlifted: str_s2UI\r\n Binder's type: Addr#\r\n*** Offending Program ***\r\n...\r\nstr_s2UI :: Addr#\r\n[LclId,\r\n Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]\r\nstr_s2UI = src<Data.Fixed.hs:78:31-39> \"MkFixed\"#\r\n\r\nstr_a2j4 :: String\r\n[LclId,\r\n Unf=Unf{Src=<vanilla>, TopLvl=False, Value=False, ConLike=True,\r\n WorkFree=False, Expandable=True, Guidance=IF_ARGS [] 20 0}]\r\nstr_a2j4 = src<Data.Fixed.hs:78:31-39> unpackCString# str_s2UI\r\n...\r\n}}}\r\n\r\n\r\nThis came up when I wanted to compile GHC HEAD with `-g`. \r\nThere are a couple of related tickets, but some of them didn't reproduce. This is a small, self-contained example.\r\nI'm hoping that it would be possible to solve this without fully solving #14123 which seems to have bigger scope.\r\n\r\nMy HEAD is d2511e3b61563ed3fc2c9aec2c90a4156373a24c.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://gitlab.haskell.org/ghc/ghc/-/issues/14786Compile-time panic with kind-level application in type famiy decl2019-07-07T18:15:36ZlyxiaCompile-time panic with kind-level application in type famiy declMinimal example:
```
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
type family E e (a :: k) (orn :: e a) :: ()
```
Error message:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):...Minimal example:
```
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
type family E e (a :: k) (orn :: e a) :: ()
```
Error message:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
getRuntimeRep
k_anW[sk:1] :: k0_aRs[tau:1]
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/types/Type.hs:1967:18 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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":"Compile-time panic with kind-level application in type famiy decl","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Minimal example:\r\n\r\n{{{\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n\r\ntype family E e (a :: k) (orn :: e a) :: ()\r\n}}}\r\n\r\nError message:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tgetRuntimeRep\r\n k_anW[sk:1] :: k0_aRs[tau:1]\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/types/Type.hs:1967:18 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14811Unary unboxed tuple field causes interface file error2019-07-07T18:15:29ZDavid FeuerUnary unboxed tuple field causes interface file errorCompiling this code under 8.2 or HEAD (but not 8.0), I get an error.
```hs
{-# language UnboxedTuples #-}
module Reccy where
data Foo a = Foo (# a #)
```
```
Reccy.hs:1:1: error:
Can't find interface-file declaration for variable ...Compiling this code under 8.2 or HEAD (but not 8.0), I get an error.
```hs
{-# language UnboxedTuples #-}
module Reccy where
data Foo a = Foo (# a #)
```
```
Reccy.hs:1:1: error:
Can't find interface-file declaration for variable GHC.Types.$tcUnit#
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
|
1 | -- {-# language GADTs, TypeOperators #-}
| ^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| 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":"Unary unboxed tuple field causes panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Compiling this code under 8.2 or HEAD (but not 8.0), I get an error.\r\n\r\n{{{#!hs\r\n{-# language UnboxedTuples #-}\r\nmodule Reccy where\r\n\r\ndata Foo a = Foo (# a #)\r\n}}}\r\n\r\n{{{\r\nReccy.hs:1:1: error:\r\n Can't find interface-file declaration for variable GHC.Types.$tcUnit#\r\n Probable cause: bug in .hi-boot file, or inconsistent .hi file\r\n Use -ddump-if-trace to get an idea of which file caused the error\r\n |\r\n1 | -- {-# language GADTs, TypeOperators #-}\r\n | ^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/14828panic! when using :print on some functions with class constraints?2021-01-12T00:18:35Zjolpanic! when using :print on some functions with class constraints?These are the problematic ones I've found:
```
> :t foldl
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
> :print foldl
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t1_...These are the problematic ones I've found:
```
> :t foldl
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
> :print foldl
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t1_a1H7[rt] :: TYPE t_a1H6[rt]
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/types/Type.hs:1952:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> :t fmap
fmap :: Functor f => (a -> b) -> f a -> f b
> :print fmap
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t1_a1Hu[rt] :: TYPE t_a1Ht[rt]
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/types/Type.hs:1952:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> :t return
return :: Monad m => a -> m a
> :print return
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t1_a1Wt[rt] :: TYPE t_a1Ws[rt]
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/types/Type.hs:1952:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> :t pure
pure :: Applicative f => a -> f a
> :print pure
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t1_a1WP[rt] :: TYPE t_a1WO[rt]
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/types/Type.hs:1952:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
These that don't have constraints are fine:
```
> :print id
id = (_t1::a -> a)
> :print map
map = (_t2::(a1 -> b) -> [a1] -> [b])
> :print const
const = (_t3::a2 -> b1 -> a2)
```
This value and function created in the session are fine:
```
> let x :: Monad m => m (); x = return ()
Prelude|
> :p x
x = (_t5::Monad m1 => m1 ())
> let f :: Monad m => Int -> m Int; f n = return (n + 1)
Prelude|
> :p f
f = (_t6::Monad m2 => Int -> m2 Int)
```
mempty and mappend imported from Data.Monoid are fine:
```
> :m + Data.Monoid
> :p mempty
mempty = (_t7::Monoid a4 => a4)
> :p mappend
mappend = (_t8::Monoid a4 => a4 -> a4 -> a4)
```
foldl' and foldr imported from Data.List are not fine:
```
> :m + Data.List
> :p foldl'
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t1_a6Qy[rt] :: TYPE t_a6Qx[rt]
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/types/Type.hs:1952:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> :p Data.List.foldr
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
isUnliftedType
t2_a6RG[rt] :: TYPE t1_a6RF[rt]
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/types/Type.hs:1952:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
but `all` and `init` from that same module are fine:
```
> :p Data.List.all
all = (_t13::Foldable t1 => (a22 -> Bool) -> t1 a22 -> Bool)
> :p Data.List.init
init = (_t14::[a29] -> [a29])
```
So, in a given module, among functions with class constraints, some have the error and others don't. I haven't found a value that's not a function with the error, and I haven't found a function with no class constraints exhibit the error.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"panic! when using :print on some functions with class constraints?","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"These are the problematic ones I've found:\r\n\r\n{{{\r\n> :t foldl\r\nfoldl :: Foldable t => (b -> a -> b) -> b -> t a -> b\r\n> :print foldl\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n t1_a1H7[rt] :: TYPE t_a1H6[rt]\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/types/Type.hs:1952:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n> :t fmap\r\nfmap :: Functor f => (a -> b) -> f a -> f b\r\n> :print fmap\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n t1_a1Hu[rt] :: TYPE t_a1Ht[rt]\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/types/Type.hs:1952:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> :t return\r\nreturn :: Monad m => a -> m a\r\n> :print return\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n t1_a1Wt[rt] :: TYPE t_a1Ws[rt]\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/types/Type.hs:1952:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> :t pure\r\npure :: Applicative f => a -> f a\r\n> :print pure\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n t1_a1WP[rt] :: TYPE t_a1WO[rt]\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/types/Type.hs:1952:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}\r\n\r\nThese that don't have constraints are fine:\r\n\r\n{{{\r\n> :print id\r\nid = (_t1::a -> a)\r\n> :print map\r\nmap = (_t2::(a1 -> b) -> [a1] -> [b])\r\n> :print const\r\nconst = (_t3::a2 -> b1 -> a2)\r\n}}}\r\n\r\nThis value and function created in the session are fine:\r\n\r\n{{{\r\n> let x :: Monad m => m (); x = return ()\r\nPrelude| \r\n> :p x\r\nx = (_t5::Monad m1 => m1 ())\r\n> let f :: Monad m => Int -> m Int; f n = return (n + 1)\r\nPrelude| \r\n> :p f\r\nf = (_t6::Monad m2 => Int -> m2 Int)\r\n}}}\r\n\r\nmempty and mappend imported from Data.Monoid are fine:\r\n\r\n{{{\r\n> :m + Data.Monoid\r\n> :p mempty\r\nmempty = (_t7::Monoid a4 => a4)\r\n> :p mappend\r\nmappend = (_t8::Monoid a4 => a4 -> a4 -> a4)\r\n}}}\r\n\r\nfoldl' and foldr imported from Data.List are not fine:\r\n\r\n{{{\r\n> :m + Data.List\r\n> :p foldl'\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n t1_a6Qy[rt] :: TYPE t_a6Qx[rt]\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/types/Type.hs:1952:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> :p Data.List.foldr\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n t2_a6RG[rt] :: TYPE t1_a6RF[rt]\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/types/Type.hs:1952:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}\r\n\r\nbut `all` and `init` from that same module are fine:\r\n\r\n{{{\r\n> :p Data.List.all\r\nall = (_t13::Foldable t1 => (a22 -> Bool) -> t1 a22 -> Bool)\r\n> :p Data.List.init\r\ninit = (_t14::[a29] -> [a29])\r\n}}}\r\n\r\nSo, in a given module, among functions with class constraints, some have the error and others don't. I haven't found a value that's not a function with the error, and I haven't found a function with no class constraints exhibit the error.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14829Linking error with ANN pragma2023-02-08T19:40:44ZehubinetteLinking error with ANN pragmaThere seems to be an issue with the ANN pragma, with fatal compilation errors.
To reproduce, setup two modules as such:
```hs
module Test where
import Weights (Weight(..))
{-# ANN mainTest (Weight 2) #-}
mainTest :: IO ()
mainTest = ...There seems to be an issue with the ANN pragma, with fatal compilation errors.
To reproduce, setup two modules as such:
```hs
module Test where
import Weights (Weight(..))
{-# ANN mainTest (Weight 2) #-}
mainTest :: IO ()
mainTest = return ()
```
```hs
{-# LANGUAGE DeriveDataTypeable #-}
module Weights (Weight(..)) where
import Data.Data (Data(..))
newtype Weight = Weight Integer deriving Data
```
Compiling with GHC version `8.2.2` yields:
```
λ ghc Test.hs
[1 of 2] Compiling Weights ( Weights.hs, Weights.o )
[2 of 2] Compiling Test ( Test.hs, Test.o )
Test.hs:5:1: fatal:
cannot find object file ‘./Weights.dyn_o’
while linking an interpreted expression
```
The issue disappears with `-dynamic` or `-dynamic-too`:
```
λ ghc -dynamic Test.hs
[1 of 2] Compiling Weights ( Weights.hs, Weights.o )
[2 of 2] Compiling Test ( Test.hs, Test.o )
```
Issue persist in HEAD, GHC version `8.5.20180219`, but again disappears with `-dynamic-too` *or* `-dynamic`:
```
λ ../../ghc/inplace/bin/ghc-stage2 -dynamic-too Test.hs
[1 of 2] Compiling Weights ( Weights.hs, Weights.o )
[2 of 2] Compiling Test ( Test.hs, Test.o )
```
Remove the ANN pragma, and the compiler behaves just fine with both GHC versions. Please tell me if I can provide more information. Cheers.https://gitlab.haskell.org/ghc/ghc/-/issues/14866GHC 8.4.1 rc1 segfaults when compiling the influxdb package2019-07-07T18:15:16ZFumiaki KinoshitaGHC 8.4.1 rc1 segfaults when compiling the influxdb packageI tried to build influxdb-1.2.2.3 with GHC 8.4.1 rc1 built with DYNAMIC_GHC_PROGRAMS=NO. Then I got
```
[ 8 of 10] Compiling Database.InfluxDB.Query ( src/Database/InfluxDB/Query.hs, /home/fumieval/hs/influxdb-haskell/dist-newstyle/buil...I tried to build influxdb-1.2.2.3 with GHC 8.4.1 rc1 built with DYNAMIC_GHC_PROGRAMS=NO. Then I got
```
[ 8 of 10] Compiling Database.InfluxDB.Query ( src/Database/InfluxDB/Query.hs, /home/fumieval/hs/influxdb-haskell/dist-newstyle/build/x86_64-linux/ghc-8.4.0.20180224/influxdb-1.2.2.3/build/Database/InfluxDB/Query.p_o )
cabal: Failed to build influxdb-1.2.2.3. The build process segfaulted (i.e.
SIGSEGV).
```
It seems to be related to Template Haskell, as it doesn't happen if I remove `makeLensesWith` in `Query.hs`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.1-alpha3 |
| 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.4.1 rc1 segfaults when compiling the influxdb package","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1-alpha3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I tried to build influxdb-1.2.2.3 with GHC 8.4.1 rc1 built with DYNAMIC_GHC_PROGRAMS=NO. Then I got\r\n\r\n{{{\r\n[ 8 of 10] Compiling Database.InfluxDB.Query ( src/Database/InfluxDB/Query.hs, /home/fumieval/hs/influxdb-haskell/dist-newstyle/build/x86_64-linux/ghc-8.4.0.20180224/influxdb-1.2.2.3/build/Database/InfluxDB/Query.p_o )\r\ncabal: Failed to build influxdb-1.2.2.3. The build process segfaulted (i.e.\r\nSIGSEGV).\r\n}}}\r\n\r\nIt seems to be related to Template Haskell, as it doesn't happen if I remove `makeLensesWith` in `Query.hs`.\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14873The well-kinded type invariant (in TcType)2021-09-07T15:47:33ZRyan ScottThe well-kinded type invariant (in TcType)(Originally noticed [here](https://travis-ci.org/goldfirere/singletons/jobs/347945148#L1179).)
The following program typechecks on GHC 8.2.2 on GHC 8.4.1, but panics on GHC HEAD:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTyp...(Originally noticed [here](https://travis-ci.org/goldfirere/singletons/jobs/347945148#L1179).)
The following program typechecks on GHC 8.2.2 on GHC 8.4.1, but panics on GHC HEAD:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind (Type)
data family Sing (a :: k)
newtype instance Sing (f :: k1 ~> k2) =
SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
class SingI (a :: k) where
sing :: Sing a
data ColSym1 :: f a -> a ~> Bool
type instance Apply (ColSym1 x) y = Col x y
class PColumn (f :: Type -> Type) where
type Col (x :: f a) (y :: a) :: Bool
class SColumn (f :: Type -> Type) where
sCol :: forall (x :: f a) (y :: a).
Sing x -> Sing y -> Sing (Col x y :: Bool)
instance (SColumn f, SingI x) => SingI (ColSym1 (x :: f a) :: a ~> Bool) where
sing = SLambda (sCol (sing @_ @x))
```
```
$ /opt/ghc/head/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.5.20180201 for x86_64-unknown-linux):
piResultTy
k_aZU[tau:1]
(a_aW8[sk:1] |> <*>_N)
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:947:35 in ghc:Type
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC HEAD regression (piResultTy)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"(Originally noticed [https://travis-ci.org/goldfirere/singletons/jobs/347945148#L1179 here].)\r\n\r\nThe following program typechecks on GHC 8.2.2 on GHC 8.4.1, but panics on GHC HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind (Type)\r\n\r\ndata family Sing (a :: k)\r\n\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }\r\n\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\n\r\nclass SingI (a :: k) where\r\n sing :: Sing a\r\n\r\ndata ColSym1 :: f a -> a ~> Bool\r\ntype instance Apply (ColSym1 x) y = Col x y\r\n\r\nclass PColumn (f :: Type -> Type) where\r\n type Col (x :: f a) (y :: a) :: Bool\r\n\r\nclass SColumn (f :: Type -> Type) where\r\n sCol :: forall (x :: f a) (y :: a).\r\n Sing x -> Sing y -> Sing (Col x y :: Bool)\r\n\r\ninstance (SColumn f, SingI x) => SingI (ColSym1 (x :: f a) :: a ~> Bool) where\r\n sing = SLambda (sCol (sing @_ @x))\r\n}}}\r\n\r\n{{{\r\n$ /opt/ghc/head/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180201 for x86_64-unknown-linux):\r\n piResultTy\r\n k_aZU[tau:1]\r\n (a_aW8[sk:1] |> <*>_N)\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/types/Type.hs:947:35 in ghc:Type\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->9.2.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/14880GHC panic: updateRole2019-07-07T18:15:13ZRyan ScottGHC panic: updateRoleThe following program panics on GHC 8.0.2, 8.2.2, 8.4.1, and HEAD:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE...The following program panics on GHC 8.0.2, 8.2.2, 8.4.1, and HEAD:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
import Data.Type.Equality ((:~:))
type SameKind (a :: k) (b :: k) = (() :: Constraint)
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
data WhyCongSym1 (x :: Type) :: forall (a :: x)
(y :: Type)
(z :: x).
Type ~> (x ~> y) ~> x ~> x ~> (a :~: z) ~> Type
data WhyCongSym0 :: forall (x :: Type)
(a :: x)
(y :: Type)
(z :: x).
Type ~> Type ~> (x ~> y) ~> x ~> x ~> (a :~: z) ~> Type
where
WhyCongSym0KindInference :: forall x arg.
SameKind (Apply WhyCongSym0 arg) (WhyCongSym1 arg) =>
WhyCongSym0 x
```
```
$ /opt/ghc/8.2.2/bin/ghci Bug.hs
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
updateRole
WhyCongSym0
arg_a1A6[sk:1]
[a1A5 :-> 4, a2Cy :-> 0, a2Cz :-> 1, a2CA :-> 2, a2CB :-> 3]
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/typecheck/TcTyDecls.hs:656:23 in ghc:TcTyDecls
```8.6.2Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/14884Type holes cause assertion failure in ghc-stage2 compiler during type checking2019-07-07T18:15:11ZTao Hesighingnow@gmail.comType holes cause assertion failure in ghc-stage2 compiler during type checkingghc-stage2 panic! due to assertion failure when compiling the following code with `ghc-stage2 Bug.hs`
```hs
module Bug where
x :: IO ()
x = _ print "abc"
```
Callstack:
```
λ inplace\bin\ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ...ghc-stage2 panic! due to assertion failure when compiling the following code with `ghc-stage2 Bug.hs`
```hs
module Bug where
x :: IO ()
x = _ print "abc"
```
Callstack:
```
λ inplace\bin\ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.5.20180225 for x86_64-unknown-mingw32):
ASSERT failed!
t_a4ec[tau:2]
2
1
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler\utils\Outputable.hs:1206:5 in ghc:Outputable
assertPprPanic, called at compiler\\typecheck\\TcType.hs:1187:83 in ghc:TcType
CallStack (from -prof):
TcInteract.solve_loop (compiler\typecheck\TcInteract.hs:(247,9)-(254,44))
TcInteract.solveSimples (compiler\typecheck\TcInteract.hs:(241,5)-(243,21))
TcRnDriver.simplifyTop (compiler\typecheck\TcRnDriver.hs:408:25-39)
TcRnDriver.tcRnSrcDecls (compiler\typecheck\TcRnDriver.hs:254:25-65)
```
The failed assertion is `checkTcLevelInvariant ctxt_tclvl tv_tclvl` in `isTouchableMetaTyVar`:
```hs
isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool
isTouchableMetaTyVar ctxt_tclvl tv
| isTyVar tv -- See Note [Coercion variables in free variable lists]
= ASSERT2( tcIsTcTyVar tv, ppr tv )
case tcTyVarDetails tv of
MetaTv { mtv_tclvl = tv_tclvl }
-> ASSERT2( checkTcLevelInvariant ctxt_tclvl tv_tclvl,
ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl )
tv_tclvl `sameDepthAs` ctxt_tclvl
_ -> False
| otherwise = False
```
Notice that the ghc-stage1 compiler doesn't panic and report the type hole correctly. This seems a regression and I have checked that ghc-8.2.2 also works well.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | |
| Type | Bug |
| 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":"Type holes cause assertion failure in ghc-stage2 compiler during type checking","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"ghc-stage2 panic! due to assertion failure when compiling the following code with `ghc-stage2 Bug.hs`\r\n\r\n{{{#!hs\r\nmodule Bug where\r\n\r\nx :: IO ()\r\nx = _ print \"abc\"\r\n}}}\r\n\r\nCallstack:\r\n\r\n{{{\r\nλ inplace\\bin\\ghc-stage2 Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180225 for x86_64-unknown-mingw32):\r\n ASSERT failed!\r\n t_a4ec[tau:2]\r\n 2\r\n 1\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\\utils\\Outputable.hs:1206:5 in ghc:Outputable\r\n assertPprPanic, called at compiler\\\\typecheck\\\\TcType.hs:1187:83 in ghc:TcType\r\nCallStack (from -prof):\r\n TcInteract.solve_loop (compiler\\typecheck\\TcInteract.hs:(247,9)-(254,44))\r\n TcInteract.solveSimples (compiler\\typecheck\\TcInteract.hs:(241,5)-(243,21))\r\n TcRnDriver.simplifyTop (compiler\\typecheck\\TcRnDriver.hs:408:25-39)\r\n TcRnDriver.tcRnSrcDecls (compiler\\typecheck\\TcRnDriver.hs:254:25-65)\r\n}}}\r\n\r\nThe failed assertion is `checkTcLevelInvariant ctxt_tclvl tv_tclvl` in `isTouchableMetaTyVar`:\r\n\r\n{{{#!hs\r\nisTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool\r\nisTouchableMetaTyVar ctxt_tclvl tv\r\n | isTyVar tv -- See Note [Coercion variables in free variable lists]\r\n = ASSERT2( tcIsTcTyVar tv, ppr tv )\r\n case tcTyVarDetails tv of\r\n MetaTv { mtv_tclvl = tv_tclvl }\r\n -> ASSERT2( checkTcLevelInvariant ctxt_tclvl tv_tclvl,\r\n ppr tv $$ ppr tv_tclvl $$ ppr ctxt_tclvl )\r\n tv_tclvl `sameDepthAs` ctxt_tclvl\r\n _ -> False\r\n | otherwise = False\r\n}}}\r\n\r\nNotice that the ghc-stage1 compiler doesn't panic and report the type hole correctly. This seems a regression and I have checked that ghc-8.2.2 also works well.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14893GHC hangs while producing error message for incorrect TypeFamilies application2019-07-07T18:15:09ZcoopercmGHC hangs while producing error message for incorrect TypeFamilies applicationHere's a minimally reproducible example:
```hs
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Main where
newtype Token f a = Token { unToken :: f a }
class Class x (f :: * -> *) where
type Meta x f :: *...Here's a minimally reproducible example:
```hs
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Main where
newtype Token f a = Token { unToken :: f a }
class Class x (f :: * -> *) where
type Meta x f :: *
type Body x f :: *
type Body x f = Token f Meta
main :: IO ()
main = return ()
```
This hangs like so
```
[2 of 2] Compiling Main ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/foo-exe/foo-exe-tmp/Main.o )
```
I tested on 8.2.2 and 8.0.2 and got the same behavior.
The closest existing bug report I could find was #12386.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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 hangs while producing error message for incorrect TypeFamilies application","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Here's a minimally reproducible example:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n\r\nmodule Main where\r\n\r\nnewtype Token f a = Token { unToken :: f a }\r\n\r\nclass Class x (f :: * -> *) where\r\n type Meta x f :: *\r\n type Body x f :: *\r\n type Body x f = Token f Meta\r\n\r\nmain :: IO ()\r\nmain = return ()\r\n\r\n}}}\r\n\r\nThis hangs like so\r\n{{{\r\n[2 of 2] Compiling Main ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.1.0/build/foo-exe/foo-exe-tmp/Main.o )\r\n\r\n}}}\r\n\r\nI tested on 8.2.2 and 8.0.2 and got the same behavior.\r\n\r\nThe closest existing bug report I could find was https://ghc.haskell.org/trac/ghc/ticket/12386.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/14898Panic with repSplitAppTys2019-07-07T18:15:08ZryanreichPanic with repSplitAppTysI get a GHC panic while compiling a rather large module that contains a fairly simple function:
```hs
import Control.Monad.Reader
usingReader ::
(Monad m) =>
r ->
(a -> ReaderT r m b)
(a -> m b)
usingReader r f = flip runReaderT...I get a GHC panic while compiling a rather large module that contains a fairly simple function:
```hs
import Control.Monad.Reader
usingReader ::
(Monad m) =>
r ->
(a -> ReaderT r m b)
(a -> m b)
usingReader r f = flip runReaderT r . f
```
Unfortunately, that function alone in a module does not trigger the panic. The error message is:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.1 for x86_64-unknown-linux):
repSplitAppTys
a_ahFs[sk:1]
ReaderT r_ahFr[sk:1] m_ahFq[sk:1] b_ahFt[sk:1]
[]
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/types/Type.hs:808:9 in ghc:Type
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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 with repSplitAppTys","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I get a GHC panic while compiling a rather large module that contains a fairly simple function:\r\n\r\n{{{#!hs\r\nimport Control.Monad.Reader\r\nusingReader ::\r\n (Monad m) =>\r\n r ->\r\n (a -> ReaderT r m b)\r\n (a -> m b)\r\nusingReader r f = flip runReaderT r . f\r\n}}}\r\n\r\nUnfortunately, that function alone in a module does not trigger the panic. The error message is:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.1 for x86_64-unknown-linux):\r\n\trepSplitAppTys\r\n a_ahFs[sk:1]\r\n ReaderT r_ahFr[sk:1] m_ahFq[sk:1] b_ahFt[sk:1]\r\n []\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/types/Type.hs:808:9 in ghc:Type\r\n}}}","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/14931Segfault compiling file that uses Template Haskell with -prof2019-07-07T18:14:59ZRyan ScottSegfault compiling file that uses Template Haskell with -profOriginally noticed [here](https://github.com/llvm-hs/llvm-hs/issues/86#issuecomment-373710312). Take the following two files:
```hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ...Originally noticed [here](https://github.com/llvm-hs/llvm-hs/issues/86#issuecomment-373710312). Take the following two files:
```hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module State (MonadState(..), Lazy.evalState) where
import qualified Control.Monad.Trans.State.Lazy as Lazy (StateT, get, put, evalState)
class Monad m => MonadState s m | m -> s where
get :: m s
put :: s -> m ()
instance Monad m => MonadState s (Lazy.StateT s m) where
get = Lazy.get
put = Lazy.put
```
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Prelude (Int, IO, Bool(..), Num(..), Monad(..), not, print)
import qualified Language.Haskell.TH.Syntax as TH
import State
wat :: IO ()
wat = print $(let playGame [] = do
(_, score) <- get
return score
playGame (x:xs) = do
(on, score) <- get
case x of
'a' | on -> put (on, score + 1)
'b' | on -> put (on, score - 1)
'c' -> put (not on, score)
_ -> put (on, score)
playGame xs
startState :: (Bool, Int)
startState = (False, 0)
in TH.lift (evalState (playGame "abcaaacbbcabbab") startState) )
```
Compiling them like so leads to a segfault:
```
$ ~/Software/ghc-8.4.1/bin/ghc -c -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi State.hs
$ ~/Software/ghc-8.4.1/bin/ghc -c -O -prof -osuf p_o -hisuf p_hi State.hs -fprof-auto
$ ~/Software/ghc-8.4.1/bin/ghc -c -O -prof -osuf p_o -hisuf p_hi Bug.hs
Segmentation fault (core dumped)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Profiling |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Segfault compiling files with -fprof-all","status":"New","operating_system":"","component":"Profiling","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Originally noticed [https://github.com/llvm-hs/llvm-hs/issues/86#issuecomment-373710312 here]. Take the following two files:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleInstances #-} \r\n{-# LANGUAGE FunctionalDependencies #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule State (MonadState(..), Lazy.evalState) where\r\n\r\nimport qualified Control.Monad.Trans.State.Lazy as Lazy (StateT, get, put, evalState)\r\n\r\nclass Monad m => MonadState s m | m -> s where\r\n get :: m s\r\n put :: s -> m ()\r\n\r\ninstance Monad m => MonadState s (Lazy.StateT s m) where\r\n get = Lazy.get\r\n put = Lazy.put\r\n}}}\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\nmodule Bug where\r\n\r\nimport Prelude (Int, IO, Bool(..), Num(..), Monad(..), not, print)\r\nimport qualified Language.Haskell.TH.Syntax as TH\r\nimport State\r\n\r\nwat :: IO ()\r\nwat = print $(let playGame [] = do\r\n (_, score) <- get\r\n return score\r\n playGame (x:xs) = do\r\n (on, score) <- get\r\n case x of\r\n 'a' | on -> put (on, score + 1)\r\n 'b' | on -> put (on, score - 1)\r\n 'c' -> put (not on, score)\r\n _ -> put (on, score)\r\n playGame xs\r\n\r\n startState :: (Bool, Int)\r\n startState = (False, 0)\r\n in TH.lift (evalState (playGame \"abcaaacbbcabbab\") startState) )\r\n}}}\r\n\r\nCompiling them like so leads to a segfault:\r\n\r\n{{{\r\n$ ~/Software/ghc-8.4.1/bin/ghc -c -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi State.hs\r\n$ ~/Software/ghc-8.4.1/bin/ghc -c -O -prof -osuf p_o -hisuf p_hi State.hs -fprof-auto\r\n$ ~/Software/ghc-8.4.1/bin/ghc -c -O -prof -osuf p_o -hisuf p_hi Bug.hs\r\nSegmentation fault (core dumped)\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://gitlab.haskell.org/ghc/ghc/-/issues/14933DeriveAnyClass can cause "No skolem info" GHC panic2019-07-07T18:14:59ZRyan ScottDeriveAnyClass can cause "No skolem info" GHC panicThis program panics:
```hs
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts ...This program panics:
```hs
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Control.Concurrent (ThreadId)
import Control.Monad.Reader
class Wrapped s where
type Unwrapped s :: *
_Wrapped' :: Iso' s (Unwrapped s)
type Iso' s a = forall f. Functor f => (a -> f a) -> s -> f s
class Fork m where
fork :: x -> m () -> m ThreadId
default fork :: ( Wrapped (m ())
, Unwrapped (m ()) ~ t ()
, Fork t
, Wrapped (m ThreadId)
, Unwrapped (m ThreadId) ~ t ThreadId
) => x -> m () -> m ThreadId
fork = undefined -- view _Unwrapped' . fork . view _Wrapped'
instance Fork m => Fork (ReaderT e m) where
fork x action = ReaderT $ \env -> fork x (runReaderT action env)
data Env
newtype MyThing m a = MyThing { unMyThing :: ReaderT Env m a }
deriving newtype (Functor, Applicative, Monad)
deriving anyclass (Fork)
instance Wrapped (MyThing m a) where
type Unwrapped (MyThing m a) = ReaderT Env m a
_Wrapped' = undefined -- iso unMyThing MyThing
```
```
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:39:24: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
No skolem info:
m_a1Hs[sk:2]
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/typecheck/TcErrors.hs:2653:5 in ghc:TcErrors
```
(Program adapted from [here](https://github.com/ekmett/lens/issues/793#issuecomment-369597846).)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.2.2 |
| Type | Bug |
| 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":"DeriveAnyClass can cause \"No skolem info\" GHC panic","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":["deriving"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This program panics:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DefaultSignatures #-}\r\n{-# LANGUAGE DeriveAnyClass #-}\r\n{-# LANGUAGE DeriveGeneric #-}\r\n{-# LANGUAGE DerivingStrategies #-}\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE GeneralizedNewtypeDeriving #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\nmodule Bug where\r\n\r\nimport Control.Concurrent (ThreadId)\r\nimport Control.Monad.Reader\r\n\r\nclass Wrapped s where\r\n type Unwrapped s :: *\r\n _Wrapped' :: Iso' s (Unwrapped s)\r\n\r\ntype Iso' s a = forall f. Functor f => (a -> f a) -> s -> f s\r\n\r\nclass Fork m where\r\n fork :: x -> m () -> m ThreadId\r\n\r\n default fork :: ( Wrapped (m ())\r\n , Unwrapped (m ()) ~ t ()\r\n , Fork t\r\n , Wrapped (m ThreadId)\r\n , Unwrapped (m ThreadId) ~ t ThreadId\r\n ) => x -> m () -> m ThreadId\r\n fork = undefined -- view _Unwrapped' . fork . view _Wrapped'\r\n\r\ninstance Fork m => Fork (ReaderT e m) where\r\n fork x action = ReaderT $ \\env -> fork x (runReaderT action env)\r\n\r\ndata Env\r\n\r\nnewtype MyThing m a = MyThing { unMyThing :: ReaderT Env m a }\r\n deriving newtype (Functor, Applicative, Monad)\r\n deriving anyclass (Fork)\r\n\r\ninstance Wrapped (MyThing m a) where\r\n type Unwrapped (MyThing m a) = ReaderT Env m a\r\n _Wrapped' = undefined -- iso unMyThing MyThing\r\n}}}\r\n\r\n{{{\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:39:24: error:ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n No skolem info:\r\n m_a1Hs[sk:2]\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/typecheck/TcErrors.hs:2653:5 in ghc:TcErrors\r\n}}}\r\n\r\n(Program adapted from [https://github.com/ekmett/lens/issues/793#issuecomment-369597846 here].)","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://gitlab.haskell.org/ghc/ghc/-/issues/14934Repeated "impossible" go_axiom_rule error.2021-04-08T13:45:22ZGalen HuntingtonRepeated "impossible" go_axiom_rule error.I am getting the following error repeatedly:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.1 for x86_64-unknown-linux):
go_axiom_rule
Sub0R
Call stack:
CallStack (from HasCallStack):
callStackDoc, cal...I am getting the following error repeatedly:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.1 for x86_64-unknown-linux):
go_axiom_rule
Sub0R
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/iface/TcIface.hs:1371:15 in ghc:TcIface
```
I got it on 8.2.1, and tried upgrading to 8.4.1 to see if it went away, but it did not.
It occurs frequently when I do a `--make` and recompile a subset of modules. I can avoid it by force-recompiling all modules, although of course this is inefficient.
Since I'm working with a codebase of thousands of lines and don't understand ghc's innards, I'm not sure where to start looking for the cause, to produce a minimal failing example. But it did start happening around the time I expanded my use of this module:
https://github.com/agrafix/superrecord
Since there are unsafe operations in there, it is possible it is doing something illicit, but it is hard to see how it would cause this.
<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":"Repeated \"impossible\" go_axiom_rule error.","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":"I am getting the following error repeatedly:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.1 for x86_64-unknown-linux):\r\n\tgo_axiom_rule\r\n Sub0R\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/iface/TcIface.hs:1371:15 in ghc:TcIface\r\n}}}\r\n\r\nI got it on 8.2.1, and tried upgrading to 8.4.1 to see if it went away, but it did not.\r\n\r\nIt occurs frequently when I do a `--make` and recompile a subset of modules. I can avoid it by force-recompiling all modules, although of course this is inefficient.\r\n\r\nSince I'm working with a codebase of thousands of lines and don't understand ghc's innards, I'm not sure where to start looking for the cause, to produce a minimal failing example. But it did start happening around the time I expanded my use of this module:\r\n\r\nhttps://github.com/agrafix/superrecord\r\n\r\nSince there are unsafe operations in there, it is possible it is doing something illicit, but it is hard to see how it would cause this.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://gitlab.haskell.org/ghc/ghc/-/issues/14953Panic when exporting duplicate record fields from separate modules2019-07-07T18:14:54ZlyxiaPanic when exporting duplicate record fields from separate modules`A.hs`
```hs
{-# LANGUAGE DuplicateRecordFields #-}
module A where
data R = R {unR :: Int}
```
---
`B.hs`
```hs
{-# LANGUAGE DuplicateRecordFields #-}
module B where
data R = R {unR :: Int}
```
---
`C.hs`
```hs
{-# LANGUAGE Duplic...`A.hs`
```hs
{-# LANGUAGE DuplicateRecordFields #-}
module A where
data R = R {unR :: Int}
```
---
`B.hs`
```hs
{-# LANGUAGE DuplicateRecordFields #-}
module B where
data R = R {unR :: Int}
```
---
`C.hs`
```hs
{-# LANGUAGE DuplicateRecordFields #-}
module C (module A, module B) where
import A
import B
```
---
Output of `ghc C.hs`:
```
C.hs:3:21: error:ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.5.20180224 for x86_64-unknown-linux):
exportClashErr
$sel:unR:R
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcRnExports.hs:740:22 in ghc:TcRnExports
```8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/14962"ghc: Out of memory" upon compiling combination of map/foldl/setBit2019-07-07T18:14:52Zmartijnbastiaan"ghc: Out of memory" upon compiling combination of map/foldl/setBitThe following code snippet:
```hs
module Test where
import Data.Bits (setBit)
f :: Integer
f = foldl setBit 0 toSet
where
toSet = [n | (n, _) <- zip [0..] [1]]
```
Fails to compile, yielding:
```
martijn@qbltop:~/code/scratch$...The following code snippet:
```hs
module Test where
import Data.Bits (setBit)
f :: Integer
f = foldl setBit 0 toSet
where
toSet = [n | (n, _) <- zip [0..] [1]]
```
Fails to compile, yielding:
```
martijn@qbltop:~/code/scratch$ ghc Test.hs -O1
[1 of 1] Compiling Test ( Test.hs, Test.o )
ghc: Out of memory
```
A few observations:
- Compiling with no optimizations (-O0) works fine
- I have not found a function other than setBit which triggers this behavior
- Changing foldl to its strict brother foldl' does not help
- Changing the type signature of "f" from "Integer" to "Int" causes the code to compile just fine
- Changing \[0..\] to something silly like \[0..2\^1024\] does not trigger the bug
I have been unable to reduce this example any further. I am using GHC 8.2.1.https://gitlab.haskell.org/ghc/ghc/-/issues/14972MacOS panic on TH2019-07-07T18:14:50ZAlec TheriaultMacOS panic on THI recently did a clean build of master (affdea82bb70e5a912b679a169c6e9a230e4c93e) and, while everything successfully finished, I'm getting panics every time I try to use this GHC for something that involves TH.
For example:
```hs
{-# l...I recently did a clean build of master (affdea82bb70e5a912b679a169c6e9a230e4c93e) and, while everything successfully finished, I'm getting panics every time I try to use this GHC for something that involves TH.
For example:
```hs
{-# language TemplateHaskell #-}
pure []
main = pure []
```
Crashes with
```
$ ./inplace/bin/ghc-stage2 th.hs
[1 of 1] Compiling Main ( th.hs, th.o )
ghc-stage2: loadArchive: Failed reading header from `/Users/atheriault/Documents/code/ghc/libraries/integer-gmp/dist-install/build/gmp'
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.5.20180325 for x86_64-apple-darwin):
loadArchive "/Users/atheriault/Documents/code/ghc/libraries/integer-gmp/dist-install/build/gmp": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Normally I'd assume I haven't correctly configured something, yet I had no problem building and running GHC on this machine a month or so ago...
<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":"MacOS panic on TH","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":"I recently did a clean build of master (affdea82bb70e5a912b679a169c6e9a230e4c93e) and, while everything successfully finished, I'm getting panics every time I try to use this GHC for something that involves TH.\r\n\r\nFor example:\r\n\r\n{{{#!hs\r\n{-# language TemplateHaskell #-}\r\n\r\npure []\r\nmain = pure []\r\n}}}\r\n\r\nCrashes with\r\n\r\n{{{\r\n$ ./inplace/bin/ghc-stage2 th.hs\r\n[1 of 1] Compiling Main ( th.hs, th.o )\r\nghc-stage2: loadArchive: Failed reading header from `/Users/atheriault/Documents/code/ghc/libraries/integer-gmp/dist-install/build/gmp'\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180325 for x86_64-apple-darwin):\r\n loadArchive \"/Users/atheriault/Documents/code/ghc/libraries/integer-gmp/dist-install/build/gmp\": failed\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nNormally I'd assume I haven't correctly configured something, yet I had no problem building and running GHC on this machine a month or so ago...","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://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/14989CBE pass 2 invalidates proc points2019-07-07T18:14:46ZSebastian GrafCBE pass 2 invalidates proc pointsThe attached file is from reduced from NoFib's `spectral/integer`.
When I compile this with `-O2 -fllvm`, I get the following panic on HEAD:
```
ghc-stage2.exe: panic! (the 'impossible' happened)
(GHC version 8.5.20180329 for x86_64-...The attached file is from reduced from NoFib's `spectral/integer`.
When I compile this with `-O2 -fllvm`, I get the following panic on HEAD:
```
ghc-stage2.exe: panic! (the 'impossible' happened)
(GHC version 8.5.20180329 for x86_64-unknown-mingw32):
Each block should be reachable from only one ProcPoint
```
FWIW, I don't have the LLVM toolchain installed, but this is still in GHC's backend.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.5 |
| 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":"\"Each block should be reachable from only one ProcPoint\" compiling `integer` with `-fllvm`","status":"New","operating_system":"Windows","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The attached file is from reduced from NoFib's `spectral/integer`.\r\n\r\nWhen I compile this with `-O2 -fllvm`, I get the following panic on HEAD:\r\n\r\n{{{\r\nghc-stage2.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180329 for x86_64-unknown-mingw32):\r\n Each block should be reachable from only one ProcPoint\r\n}}}\r\n\r\nFWIW, I don't have the LLVM toolchain installed, but this is still in GHC's backend.","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15002Panic: collectNBinders2023-09-01T12:15:47ZEric CrockettPanic: collectNBindersSteps to reproduce:
Download concurrent-extra-0.7.0.12 and add the following stack.yaml file:
```
resolver: nightly-2018-04-04
system-ghc: true
compiler-check: newer-minor
```
Then run:
```
> ghc --version
The Glorious Glasgow Haskel...Steps to reproduce:
Download concurrent-extra-0.7.0.12 and add the following stack.yaml file:
```
resolver: nightly-2018-04-04
system-ghc: true
compiler-check: newer-minor
```
Then run:
```
> ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.1.20180329
> stack build --library-profiling
concurrent-extra-0.7.0.12: build (lib)
Preprocessing library for concurrent-extra-0.7.0.12..
Building library for concurrent-extra-0.7.0.12..
[7 of 8] Compiling Control.Concurrent.Broadcast ( Control/Concurrent/Broadcast.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Control/Concurrent/Broadcast.p_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.1.20180329 for x86_64-unknown-linux):
collectNBinders
1
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/coreSyn/CoreSyn.hs:2189:39 in ghc:CoreSyn
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
-- While building custom Setup.hs for package concurrent-extra-0.7.0.12 using:
/home/local/ANT/ericcro/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.1.20180329 --builddir=.stack-work/dist/x86_64-linux/Cabal-2.2.0.1 build lib:concurrent-extra --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
```8.4.2Joachim Breitnermail@joachim-breitner.deJoachim Breitnermail@joachim-breitner.dehttps://gitlab.haskell.org/ghc/ghc/-/issues/15005GHC fails with “StgCmmEnv: variable not found” when trying to compile order-m...2019-07-07T18:14:43ZWolfgang JeltschGHC fails with “StgCmmEnv: variable not found” when trying to compile order-maintenance-0.2.1.0When trying to build `order-maintenance-0.2.1.0`, GHC 8.4.2-rc1 panics. Its output is as follows:
```
[ 1 of 21] Compiling Data.Order.Algorithm.Raw ( src/library/Data/Order/Algorithm/Raw.hs, /home/wolfgang/Entwicklung/Haskell/order-main...When trying to build `order-maintenance-0.2.1.0`, GHC 8.4.2-rc1 panics. Its output is as follows:
```
[ 1 of 21] Compiling Data.Order.Algorithm.Raw ( src/library/Data/Order/Algorithm/Raw.hs, /home/wolfgang/Entwicklung/Haskell/order-maintenance-0.2.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.1.20180329/order-maintenance-0.2.1.0/build/Data/Order/Algorithm/Raw.o )
[ 2 of 21] Compiling Data.Order.Algorithm.Raw.DietzSleatorAmortizedLog ( src/library/Data/Order/Algorithm/Raw/DietzSleatorAmortizedLog.hs, /home/wolfgang/Entwicklung/Haskell/order-maintenance-0.2.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.1.20180329/order-maintenance-0.2.1.0/build/Data/Order/Algorithm/Raw/DietzSleatorAmortizedLog.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.1.20180329 for x86_64-unknown-linux):
StgCmmEnv: variable not found
x_a46z
local binds for:
$tc'Label
$tcLabel
$tc'Cell
$tcCell
$trModule
$tc'Cell1
$tc'Cell2
$tc'Cell3
$trModule1
$trModule2
$trModule3
$trModule4
$tc'Label1
$tc'Label2
$tc'Label3
$tcCell1
$tcCell2
$tcLabel1
$tcLabel2
lvl_r4UD
lvl1_r4UE
lvl2_r4UF
lvl3_r4UG
lvl4_r4UH
lvl5_r4UI
lvl6_r4UJ
lvl7_r4UK
lvl8_r4UL
lvl9_r4UM
lvl10_r4UN
lvl11_r4UO
lvl12_r4UP
lvl13_r4UQ
lvl14_r4UR
lvl15_r4US
lvl16_r4UT
lvl17_r4UU
$krep_r4UV
$krep1_r4UW
$krep2_r4UX
lvl18_r4UY
$krep3_r4UZ
$krep4_r4V0
$krep5_r4V1
$krep6_r4V2
$krep7_r4V3
$krep8_r4V4
$krep9_r4V5
lvl19_r4V6
lvl20_r4V7
lvl21_r4V8
lvl22_r4V9
lvl23_r4Va
lvl24_r4Vb
lvl25_r4Vc
ww_s4W2
lwild_s4W3
lwild1_s4W4
noOfLabels_s4W5
noOfLabels1_s4W6
labelMask_s4W7
$wnewAfterCell_s4Wa
ww1_s4Wb
ipv1_s4Wf
wild_s4Wg
ds_s4Wh
ds2_s4Wi
ww2_s4Wk
ww3_s4Wl
ww4_s4Wn
ww5_s4Wo
wild1_s4Wq
smallGap_s4Wr
wild2_s4Ws
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The same problem exists with GHC 8.4.1.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.2-rc1 |
| 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 fails with “StgCmmEnv: variable not found” when trying to compile order-maintenance-0.2.1.0","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.4.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.2-rc1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When trying to build `order-maintenance-0.2.1.0`, GHC 8.4.2-rc1 panics. Its output is as follows:\r\n\r\n{{{\r\n[ 1 of 21] Compiling Data.Order.Algorithm.Raw ( src/library/Data/Order/Algorithm/Raw.hs, /home/wolfgang/Entwicklung/Haskell/order-maintenance-0.2.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.1.20180329/order-maintenance-0.2.1.0/build/Data/Order/Algorithm/Raw.o )\r\n[ 2 of 21] Compiling Data.Order.Algorithm.Raw.DietzSleatorAmortizedLog ( src/library/Data/Order/Algorithm/Raw/DietzSleatorAmortizedLog.hs, /home/wolfgang/Entwicklung/Haskell/order-maintenance-0.2.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.1.20180329/order-maintenance-0.2.1.0/build/Data/Order/Algorithm/Raw/DietzSleatorAmortizedLog.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.1.20180329 for x86_64-unknown-linux):\r\n\tStgCmmEnv: variable not found\r\n x_a46z\r\n local binds for:\r\n $tc'Label\r\n $tcLabel\r\n $tc'Cell\r\n $tcCell\r\n $trModule\r\n $tc'Cell1\r\n $tc'Cell2\r\n $tc'Cell3\r\n $trModule1\r\n $trModule2\r\n $trModule3\r\n $trModule4\r\n $tc'Label1\r\n $tc'Label2\r\n $tc'Label3\r\n $tcCell1\r\n $tcCell2\r\n $tcLabel1\r\n $tcLabel2\r\n lvl_r4UD\r\n lvl1_r4UE\r\n lvl2_r4UF\r\n lvl3_r4UG\r\n lvl4_r4UH\r\n lvl5_r4UI\r\n lvl6_r4UJ\r\n lvl7_r4UK\r\n lvl8_r4UL\r\n lvl9_r4UM\r\n lvl10_r4UN\r\n lvl11_r4UO\r\n lvl12_r4UP\r\n lvl13_r4UQ\r\n lvl14_r4UR\r\n lvl15_r4US\r\n lvl16_r4UT\r\n lvl17_r4UU\r\n $krep_r4UV\r\n $krep1_r4UW\r\n $krep2_r4UX\r\n lvl18_r4UY\r\n $krep3_r4UZ\r\n $krep4_r4V0\r\n $krep5_r4V1\r\n $krep6_r4V2\r\n $krep7_r4V3\r\n $krep8_r4V4\r\n $krep9_r4V5\r\n lvl19_r4V6\r\n lvl20_r4V7\r\n lvl21_r4V8\r\n lvl22_r4V9\r\n lvl23_r4Va\r\n lvl24_r4Vb\r\n lvl25_r4Vc\r\n ww_s4W2\r\n lwild_s4W3\r\n lwild1_s4W4\r\n noOfLabels_s4W5\r\n noOfLabels1_s4W6\r\n labelMask_s4W7\r\n $wnewAfterCell_s4Wa\r\n ww1_s4Wb\r\n ipv1_s4Wf\r\n wild_s4Wg\r\n ds_s4Wh\r\n ds2_s4Wi\r\n ww2_s4Wk\r\n ww3_s4Wl\r\n ww4_s4Wn\r\n ww5_s4Wo\r\n wild1_s4Wq\r\n smallGap_s4Wr\r\n wild2_s4Ws\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/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThe same problem exists with GHC 8.4.1.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://gitlab.haskell.org/ghc/ghc/-/issues/15013Building nofib using llvm and HEAD fails2019-07-07T18:14:41ZAndreas KlebingerBuilding nofib using llvm and HEAD fails```
== make all ;
in /home/Andi/ghc_head/nofib/shootout/pidigits
------------------------------------------------------------------------
HC = /home/Andi/ghc_head/inplace/bin/ghc-stage2
HC_OPTS = -O2 -Rghc-timing -H32m -hisuf hi -fllvm ...```
== make all ;
in /home/Andi/ghc_head/nofib/shootout/pidigits
------------------------------------------------------------------------
HC = /home/Andi/ghc_head/inplace/bin/ghc-stage2
HC_OPTS = -O2 -Rghc-timing -H32m -hisuf hi -fllvm -rtsopts -O2
RUNTEST_OPTS = -ghc-timing
==nofib== pidigits: time to compile Main follows...
/home/Andi/ghc_head/inplace/bin/ghc-stage2 -O2 -Rghc-timing -H32m -hisuf hi -fllvm -rtsopts -O2 -c Main.hs -o Main.o
ghc-stage2.exe: panic! (the 'impossible' happened)
(GHC version 8.5.20180401 for x86_64-unknown-mingw32):
Each block should be reachable from only one ProcPoint
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
<<ghc: 506688344 bytes, 156 GCs, 7738569/16639872 avg/max bytes residency (5 samples), 37M in use, 0.000 INIT (0.000 elapsed), 0.344 MUT (0.333 elapsed), 0.062 GC (0.112 elapsed) :ghc>>
make[1]: *** [../../mk/suffix.mk:23: Main.o] Error 1
Failed making all in pidigits: 1
make: *** [../mk/ghc-recurse.mk:69: all] Error 1
$ opt --version
LLVM (http://llvm.org/):
LLVM version 5.0.1
Optimized build.
Default target: x86_64-w64-windows-gnu
Host CPU: skylake
```
This is on commit 8b823f270e53627ddca1a993c05f1ab556742d96
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | --------------- |
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (LLVM) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Building nofib using llvm and HEAD fails","status":"New","operating_system":"","component":"Compiler (LLVM)","related":[],"milestone":"8.4.2","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\n{{{\r\n== make all ;\r\n in /home/Andi/ghc_head/nofib/shootout/pidigits\r\n------------------------------------------------------------------------\r\nHC = /home/Andi/ghc_head/inplace/bin/ghc-stage2\r\nHC_OPTS = -O2 -Rghc-timing -H32m -hisuf hi -fllvm -rtsopts -O2\r\nRUNTEST_OPTS = -ghc-timing\r\n==nofib== pidigits: time to compile Main follows...\r\n/home/Andi/ghc_head/inplace/bin/ghc-stage2 -O2 -Rghc-timing -H32m -hisuf hi -fllvm -rtsopts -O2 -c Main.hs -o Main.o\r\nghc-stage2.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180401 for x86_64-unknown-mingw32):\r\n Each block should be reachable from only one ProcPoint\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n<<ghc: 506688344 bytes, 156 GCs, 7738569/16639872 avg/max bytes residency (5 samples), 37M in use, 0.000 INIT (0.000 elapsed), 0.344 MUT (0.333 elapsed), 0.062 GC (0.112 elapsed) :ghc>>\r\nmake[1]: *** [../../mk/suffix.mk:23: Main.o] Error 1\r\nFailed making all in pidigits: 1\r\nmake: *** [../mk/ghc-recurse.mk:69: all] Error 1\r\n\r\n$ opt --version\r\nLLVM (http://llvm.org/):\r\n LLVM version 5.0.1\r\n Optimized build.\r\n Default target: x86_64-w64-windows-gnu\r\n Host CPU: skylake\r\n\r\n}}}\r\n\r\nThis is on commit 8b823f270e53627ddca1a993c05f1ab556742d96\r\n","type_of_failure":"OtherFailure","blocking":[]} -->⊥https://gitlab.haskell.org/ghc/ghc/-/issues/15035Panic when using StaticPointers with typed holes2019-07-07T18:14:36ZutdemirPanic when using StaticPointers with typed holesAdding a type hole when there is a type variable in `StaticPtr` throws a GHC panic:
```hs
{-# LANGUAGE StaticPointers #-}
module Foo where
import Data.Typeable
import GHC.StaticPtr
foo :: Typeable a => StaticPtr a
foo = static _
```...Adding a type hole when there is a type variable in `StaticPtr` throws a GHC panic:
```hs
{-# LANGUAGE StaticPointers #-}
module Foo where
import Data.Typeable
import GHC.StaticPtr
foo :: Typeable a => StaticPtr a
foo = static _
```
```
[1 of 1] Compiling Foo ( test.hs, test.o )
test.hs:9:14: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.4.1 for x86_64-unknown-linux):
No skolem info:
[a_aD2[sk:2]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcErrors.hs:2945:5 in ghc:TcErrors
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
This panics on both GHC 8.2.2 and 8.4.1.
<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":"Panic when using StaticPointers with typed holes","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Adding a type hole when there is a type variable in `StaticPtr` throws a GHC panic:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE StaticPointers #-}\r\n\r\nmodule Foo where\r\n\r\nimport Data.Typeable\r\nimport GHC.StaticPtr\r\n\r\nfoo :: Typeable a => StaticPtr a\r\nfoo = static _ \r\n}}}\r\n\r\n{{{\r\n\r\n[1 of 1] Compiling Foo ( test.hs, test.o )\r\n\r\ntest.hs:9:14: error:ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.1 for x86_64-unknown-linux):\r\n\tNo skolem info:\r\n [a_aD2[sk:2]]\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/typecheck/TcErrors.hs:2945:5 in ghc:TcErrors\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThis panics on both GHC 8.2.2 and 8.4.1.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15037Running 1 twice, followed by a typed hole, in GHCi causes internal error2019-07-07T18:14:36ZRyan ScottRunning 1 twice, followed by a typed hole, in GHCi causes internal errorOriginally reported in #14996\##15037. You need GHC HEAD (i.e., more recent than GHC 8.4.1) to trigger this:
```
$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.5.20180413: http://www.haskell.org/ghc/ :? for help
Loaded GHCi con...Originally reported in #14996\##15037. You need GHC HEAD (i.e., more recent than GHC 8.4.1) to trigger this:
```
$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.5.20180413: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> 1
1
λ> 1
1
λ> _
<interactive>:1:1: error:
GHC internal error: ‘Ghci1.it’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: []
```
And yes, running `1` //twice// seems to be critical to triggering this bug, for some reason.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Running 1 twice, followed by a typed hole, in GHCi causes internal error","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypedHoles"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Originally reported in https://ghc.haskell.org/trac/ghc/ticket/14996#comment:2. You need GHC HEAD (i.e., more recent than GHC 8.4.1) to trigger this:\r\n\r\n{{{\r\n$ inplace/bin/ghc-stage2 --interactive\r\nGHCi, version 8.5.20180413: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\nλ> 1\r\n1\r\nλ> 1\r\n1\r\nλ> _\r\n\r\n<interactive>:1:1: error:\r\n GHC internal error: ‘Ghci1.it’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: []\r\n}}}\r\n\r\nAnd yes, running `1` //twice// seems to be critical to triggering this bug, for some reason.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15053Compiler panic on invalid syntax (unterminated pragma)2019-07-07T18:14:31ZAndreas KlebingerCompiler panic on invalid syntax (unterminated pragma)The following minimal example causes a compiler panic.
```
{-# OPTIONS_GHC -O1 }
"
#-}
```
```
ghc-stage2.exe: panic! (the 'impossible' happened)
(GHC version 8.5.20180413 for x86_64-unknown-mingw32):
getOptions'.parseToks:...The following minimal example causes a compiler panic.
```
{-# OPTIONS_GHC -O1 }
"
#-}
```
```
ghc-stage2.exe: panic! (the 'impossible' happened)
(GHC version 8.5.20180413 for x86_64-unknown-mingw32):
getOptions'.parseToks: Couldn't read "\r\n\"\r\n " as String
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Happens in HEAD and 8.2.2 at least. Double quotes seem to confuse the parser. Also panics if there are two doublequotes.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Compiler panic on invalid syntax (unterminated pragma)","status":"New","operating_system":"","component":"Compiler (Parser)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following minimal example causes a compiler panic.\r\n{{{\r\n{-# OPTIONS_GHC -O1 }\r\n\"\r\n #-}\r\n}}}\r\n\r\n\r\n{{{\r\nghc-stage2.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180413 for x86_64-unknown-mingw32):\r\n getOptions'.parseToks: Couldn't read \"\\r\\n\\\"\\r\\n \" as String\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nHappens in HEAD and 8.2.2 at least. Double quotes seem to confuse the parser. Also panics if there are two doublequotes.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2Roland SennRoland Sennhttps://gitlab.haskell.org/ghc/ghc/-/issues/15076Typed hole with higher-rank kind causes GHC to panic (No skolem info)2019-07-07T18:14:23ZRyan ScottTyped hole with higher-rank kind causes GHC to panic (No skolem info)Spun out from #14040\#[ticket:15076\#comment:152359](https://gitlab.haskell.org//ghc/ghc/issues/15076#note_152359), which was different enough from the original program in #14040 to warrant its own ticket. The following program panics on...Spun out from #14040\#[ticket:15076\#comment:152359](https://gitlab.haskell.org//ghc/ghc/issues/15076#note_152359), which was different enough from the original program in #14040 to warrant its own ticket. The following program panics on every version of GHC from 8.0.2 onward:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
import Data.Proxy
foo :: forall (a :: Type)
(f :: forall (x :: a). Proxy x -> Type).
Proxy f -> ()
foo (_ :: _) = ()
```
```
$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:12:11: error:ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.5.20180420 for x86_64-unknown-linux):
No skolem info:
[a_aZo[sk:1]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1162:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcErrors.hs:3224:5 in ghc:TcErrors
```8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15102GHC panic when compiling gi-pango-1.0.152019-07-07T18:14:15Zpaul@cogito.org.ukGHC panic when compiling gi-pango-1.0.15I got the following error message:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
tcIfaceGlobal (local): not found
You are in a maze of twisty little passages, all alike...I got the following error message:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.2.2 for x86_64-unknown-linux):
tcIfaceGlobal (local): not found
You are in a maze of twisty little passages, all alike.
While forcing the thunk for TyThing Layout
which was lazily initialized by initIfaceCheck typecheckLoop,
I tried to tie the knot, but I couldn't find Layout
in the current type environment.
If you are developing GHC, please read Note [Tying the knot]
and Note [Type-checking inside the knot].
Consider rebuilding GHC with profiling for a better stack trace.
Contents of current type environment: []
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/iface/TcIface.hs:1696:23 in ghc:TcIface
```
A self-contained Stack project that demonstrates the problem is attached. I'm using Stack Version 1.6.3 x86_64 hpack-0.20.0
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.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 when compiling gi-pango-1.0.15","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I got the following error message:\r\n\r\n\r\n{{{\r\n ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.2.2 for x86_64-unknown-linux):\r\n tcIfaceGlobal (local): not found\r\n You are in a maze of twisty little passages, all alike.\r\n While forcing the thunk for TyThing Layout\r\n which was lazily initialized by initIfaceCheck typecheckLoop,\r\n I tried to tie the knot, but I couldn't find Layout\r\n in the current type environment.\r\n If you are developing GHC, please read Note [Tying the knot]\r\n and Note [Type-checking inside the knot].\r\n Consider rebuilding GHC with profiling for a better stack trace.\r\n Contents of current type environment: []\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/iface/TcIface.hs:1696:23 in ghc:TcIface\r\n}}}\r\n\r\nA self-contained Stack project that demonstrates the problem is attached. I'm using Stack Version 1.6.3 x86_64 hpack-0.20.0\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15108Panic: collectNBinders2023-09-01T12:15:47ZcdisselkoenPanic: collectNBindersGHC 8.4.2 panics with the error message `collectNBinders`, when compiling with profiling. This is a very similar bug to #15002, but although #15002 is fixed in 8.4.2, this panic persists.
Steps to reproduce:
`stack.yaml`:
```
resolver...GHC 8.4.2 panics with the error message `collectNBinders`, when compiling with profiling. This is a very similar bug to #15002, but although #15002 is fixed in 8.4.2, this panic persists.
Steps to reproduce:
`stack.yaml`:
```
resolver: nightly-2018-04-30
```
`bug.cabal`:
```
name: bug
version: 0.1.0.0
build-type: Simple
cabal-version: >=1.10
executable bug
main-is: Main.hs
build-depends: base
default-language: Haskell2010
```
`Main.hs`:
```
module Main where
main :: IO ()
main = do
_ <- return $ getInt Circle
return ()
newtype MyInt = MyInt Int
data Shape = Circle
| Square
getInt :: Shape -> MyInt
getInt sh =
case sh of
Circle ->
let (MyInt i) = MyInt 3
in myInt i
Square ->
let (MyInt i) = MyInt 2
in myInt i
where
myInt = MyInt
```
Then run:
```
$ stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.4.2
$ stack build --profile
bug-0.1.0.0: configure (exe)
Configuring bug-0.1.0.0...
bug-0.1.0.0: build (exe)
Preprocessing executable 'bug' for bug-0.1.0.0..
Building executable 'bug' for bug-0.1.0.0..
[1 of 1] Compiling Main ( Main.hs, .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.2.0.1/build/bug/bug-tmp/Main.p_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.2 for x86_64-unknown-linux):
collectNBinders
1
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/coreSyn/CoreSyn.hs:2025:25 in ghc:CoreSyn
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
-- While building custom Setup.hs for package bug-0.1.0.0 using:
/usr/local/home/cdisselk/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-2.2.0.1 build exe:bug --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
```8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15116GHC internal error when GADT return type mentions its own constructor name2019-07-07T18:14:11ZRyan ScottGHC internal error when GADT return type mentions its own constructor nameTake the following program:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeInType #-}
module Bug where
data A (a :: k) where
MkA :: A MkA
```
On GHC 8.4.2, this is rejected with a sensible error message:
```
$ /opt/ghc/8.4.2/bin/ghc...Take the following program:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeInType #-}
module Bug where
data A (a :: k) where
MkA :: A MkA
```
On GHC 8.4.2, this is rejected with a sensible error message:
```
$ /opt/ghc/8.4.2/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:6:12: error:
• Data constructor ‘MkA’ cannot be used here
(it is defined and used in the same recursive group)
• In the first argument of ‘A’, namely ‘MkA’
In the type ‘A MkA’
In the definition of data constructor ‘MkA’
|
6 | MkA :: A MkA
| ^^^
```
On GHC HEAD, however, this causes a GHC internal error:
```
$ ghc2/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:6:12: error:
• GHC internal error: ‘MkA’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: [asv :-> Type variable ‘k’ = k :: *,
asw :-> Type variable ‘a’ = a :: k,
rqs :-> ATcTyCon A :: forall k. k -> *]
• In the first argument of ‘A’, namely ‘MkA’
In the type ‘A MkA’
In the definition of data constructor ‘MkA’
|
6 | MkA :: A MkA
| ^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| 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":"GHC internal error when GADT return type mentions its own constructor name","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["GADTs,","TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Take the following program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE TypeInType #-}\r\nmodule Bug where\r\n\r\ndata A (a :: k) where\r\n MkA :: A MkA\r\n}}}\r\n\r\nOn GHC 8.4.2, this is rejected with a sensible error message:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.2/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:6:12: error:\r\n • Data constructor ‘MkA’ cannot be used here\r\n (it is defined and used in the same recursive group)\r\n • In the first argument of ‘A’, namely ‘MkA’\r\n In the type ‘A MkA’\r\n In the definition of data constructor ‘MkA’\r\n |\r\n6 | MkA :: A MkA\r\n | ^^^\r\n}}}\r\n\r\nOn GHC HEAD, however, this causes a GHC internal error:\r\n\r\n{{{\r\n$ ghc2/inplace/bin/ghc-stage2 Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:6:12: error:\r\n • GHC internal error: ‘MkA’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: [asv :-> Type variable ‘k’ = k :: *,\r\n asw :-> Type variable ‘a’ = a :: k,\r\n rqs :-> ATcTyCon A :: forall k. k -> *]\r\n • In the first argument of ‘A’, namely ‘MkA’\r\n In the type ‘A MkA’\r\n In the definition of data constructor ‘MkA’\r\n |\r\n6 | MkA :: A MkA\r\n | ^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15142GHC HEAD regression: tcTyVarDetails2019-07-07T18:14:05ZRyan ScottGHC HEAD regression: tcTyVarDetailsThis regression prevents the `generic-lens` library from building. Here is a minimized test case:
```hs
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
...This regression prevents the `generic-lens` library from building. Here is a minimized test case:
```hs
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
class ListTuple (tuple :: Type) (as :: [(k, Type)]) where
type ListToTuple as :: Type
```
On GHC 8.4.2, this compiles, but on GHC HEAD, it panics:
```
$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.5.20180511 for x86_64-unknown-linux):
tcTyVarDetails
co_aWx :: (k_aWt[tau:2] :: *) ~# (* :: *)
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1162:37 in ghc:Outputable
pprPanic, called at compiler/basicTypes/Var.hs:497:22 in ghc:Var
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC HEAD regression: tcTyVarDetails","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypeFamilies","TypeInType,"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This regression prevents the `generic-lens` library from building. Here is a minimized test case:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\nclass ListTuple (tuple :: Type) (as :: [(k, Type)]) where\r\n type ListToTuple as :: Type\r\n}}}\r\n\r\nOn GHC 8.4.2, this compiles, but on GHC HEAD, it panics:\r\n\r\n{{{\r\n$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180511 for x86_64-unknown-linux):\r\n tcTyVarDetails\r\n co_aWx :: (k_aWt[tau:2] :: *) ~# (* :: *)\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1162:37 in ghc:Outputable\r\n pprPanic, called at compiler/basicTypes/Var.hs:497:22 in ghc:Var\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/15154Segmentation fault of ghc-pkg.exe from 32-bit distribution of ghc-8.2.2 on Wi...2019-07-07T18:14:01Zki11men0wSegmentation fault of ghc-pkg.exe from 32-bit distribution of ghc-8.2.2 on Windows 7On `Windows 7` call of `ghc-pkg` utility from `32-bit` `ghc-8.2.2` distribution is always ended with `Segmentation fault` error.
With use of `Cygwin` the error can be reproduced this way: run `cmd.exe` and in the appeared console window...On `Windows 7` call of `ghc-pkg` utility from `32-bit` `ghc-8.2.2` distribution is always ended with `Segmentation fault` error.
With use of `Cygwin` the error can be reproduced this way: run `cmd.exe` and in the appeared console window execute the following commands
```bash
c:\Users\user.name\wrk> bash
$ mkdir ghc-pkg-check
$ cd ghc-pkg-check
$ curl https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-i386-unknown-mingw32.tar.xz > ghc-8.2.2-i386-unknown-mingw32.tar.xz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 163M 100 163M 0 0 3669k 0 0:00:45 0:00:45 --:--:-- 4776k
$ xz -dc ghc-8.2.2-i386-unknown-mingw32.tar.xz | tar -xf -
$ cd ghc-8.2.2/bin/
$ ./ghc-pkg.exe --version
GHC package manager version 8.2.2
Segmentation fault
```
The error arises irrespective of how and with what arguments to call `ghc-pkg` utility. For example, firstly I has faced the problem using `stack` from Windows console:
```bat
> stack build --arch=i386 --resolver=11.9
```
I checked another distributions of GHC for presence of this bug on `Windows 7`. 64-bit version of ghc-8.2.2, 32-bit and 64-bit versions of ghc-8.0.2 and ghc-8.4.2 are free of the problem. I \*\*did not check\*\* the problem \*\*on another versions\*\* of MS Windows.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.2.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | ghc-pkg |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Segmentation fault of ghc-pkg.exe from 32-bit distribution of ghc-8.2.2 on Windows 7","status":"New","operating_system":"","component":"ghc-pkg","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"On `Windows 7` call of `ghc-pkg` utility from `32-bit` `ghc-8.2.2` distribution is always ended with `Segmentation fault` error.\r\n\r\nWith use of `Cygwin` the error can be reproduced this way: run `cmd.exe` and in the appeared console window execute the following commands\r\n{{{#!bash\r\nc:\\Users\\user.name\\wrk> bash\r\n$ mkdir ghc-pkg-check\r\n$ cd ghc-pkg-check\r\n$ curl https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-i386-unknown-mingw32.tar.xz > ghc-8.2.2-i386-unknown-mingw32.tar.xz\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 163M 100 163M 0 0 3669k 0 0:00:45 0:00:45 --:--:-- 4776k\r\n\r\n$ xz -dc ghc-8.2.2-i386-unknown-mingw32.tar.xz | tar -xf -\r\n$ cd ghc-8.2.2/bin/\r\n$ ./ghc-pkg.exe --version\r\nGHC package manager version 8.2.2\r\nSegmentation fault\r\n}}}\r\n\r\nThe error arises irrespective of how and with what arguments to call `ghc-pkg` utility. For example, firstly I has faced the problem using `stack` from Windows console:\r\n{{{#!bat\r\n> stack build --arch=i386 --resolver=11.9\r\n}}}\r\n\r\nI checked another distributions of GHC for presence of this bug on `Windows 7`. 64-bit version of ghc-8.2.2, 32-bit and 64-bit versions of ghc-8.0.2 and ghc-8.4.2 are free of the problem. I **did not check** the problem **on another versions** of MS Windows.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15168GHC HEAD crashes on Windows 64 after the SRT overhaul (May 16, 2018 and newer)2019-07-07T18:13:57ZawsonGHC HEAD crashes on Windows 64 after the SRT overhaul (May 16, 2018 and newer)After the series of SRT overhaul patches GHC doesn't work on Windows 64-bit.
GHC executable crashes (AV) on any attempt to compile anything or even to start in interactive mode. When crashed it report crash address which may look not as...After the series of SRT overhaul patches GHC doesn't work on Windows 64-bit.
GHC executable crashes (AV) on any attempt to compile anything or even to start in interactive mode. When crashed it report crash address which may look not as a real address at all (e.g. 0x800 or 0xffffffffffffffff) and may report either reading from or executing such an address.
OTOH, when started with, e.g. `+RTS -A256m -RTS` it is able to compile some programs (`haddock` at least).
Reverting all related commits down to eb8e692cab7970c495681e14721d05ecadd21581 make things work again.
I have no proof that things went bad exactly at eb8e692cab7970c495681e14721d05ecadd21581. Perhaps, this happened later on, but I have a proof that things were good immediately before.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.5 |
| 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":"GHC HEAD crashes on Windows 64 after the SRT overhaul (May 16, 2018 and newer)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"After the series of SRT overhaul patches GHC doesn't work on Windows 64-bit.\r\n\r\nGHC executable crashes (AV) on any attempt to compile anything or even to start in interactive mode. When crashed it report crash address which may look not as a real address at all (e.g. 0x800 or 0xffffffffffffffff) and may report either reading from or executing such an address.\r\n\r\nOTOH, when started with, e.g. `+RTS -A256m -RTS` it is able to compile some programs (`haddock` at least).\r\n\r\nReverting all related commits down to eb8e692cab7970c495681e14721d05ecadd21581 make things work again.\r\n\r\nI have no proof that things went bad exactly at eb8e692cab7970c495681e14721d05ecadd21581. Perhaps, this happened later on, but I have a proof that things were good immediately before.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15170GHC HEAD panic (dischargeFmv)2019-07-07T18:13:56ZRyan ScottGHC HEAD panic (dischargeFmv)The following program panics on GHC HEAD:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariable...The following program panics on GHC HEAD:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
import Data.Proxy
data family Sing (a :: k)
data SomeSing :: Type -> Type where
SomeSing :: Sing (a :: k) -> SomeSing k
class SingKind k where
type Demote k = (r :: Type) | r -> k
fromSing :: Sing (a :: k) -> Demote k
toSing :: Demote k -> SomeSing k
withSomeSing :: forall k r
. SingKind k
=> Demote k
-> (forall (a :: k). Sing a -> r)
-> r
withSomeSing x f =
case toSing x of
SomeSing x' -> f x'
newtype instance Sing (f :: k1 ~> k2) =
SLambda { applySing :: forall t. Sing t -> Sing (f @@ t) }
instance (SingKind k1, SingKind k2) => SingKind (k1 ~> k2) where
type Demote (k1 ~> k2) = Demote k1 -> Demote k2
fromSing sFun x = withSomeSing x (fromSing . applySing sFun)
toSing = undefined
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
type f @@ x = Apply f x
infixl 9 @@
dcomp :: forall (a :: Type)
(b :: a ~> Type)
(c :: forall (x :: a). Proxy x ~> b @@ x ~> Type)
(f :: forall (x :: a) (y :: b @@ x). Proxy x ~> Proxy y ~> c @@ ('Proxy :: Proxy x) @@ y)
(g :: forall (x :: a). Proxy x ~> b @@ x)
(x :: a).
SingKind (c @@ ('Proxy :: Proxy x) @@ (g @@ ('Proxy :: Proxy x)))
=> (forall (xx :: a) (yy :: b @@ xx). Sing (f @@ ('Proxy :: Proxy xx) @@ ('Proxy :: Proxy yy)))
-> Sing g
-> Sing a
-> Demote (c @@ ('Proxy :: Proxy x) @@ (g @@ ('Proxy :: Proxy x)))
dcomp _sf _ _ = undefined
```
```
$ /opt/ghc/head/bin/ghc Bug2.hs
[1 of 1] Compiling Bug ( Bug2.hs, Bug2.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.5.20180501 for x86_64-unknown-linux):
dischargeFmv
[D] _ {0}:: (Apply
(f_a1ih[sk:2] xx_a1iA[tau:3] yy_a1iB[tau:3] |> Sym ((TyFun
<Proxy xx_a1iA[tau:3]>_N
((TyFun
(Proxy
(Sym {co_a1jm})
(Coh <yy_a1iB[tau:3]>_N
{co_a1jm}))_N
(Sym {co_a1jB} ; (Apply
(Sym {co_a1jm})
<*>_N
(Coh ((Coh <s_a1jn[fmv:0]>_N
((TyFun
(Sym {co_a1jm})
<*>_N)_N
->_N <*>_N) ; Sym {co_a1jA}) ; (Apply
<Proxy
xx_a1iA[tau:3]>_N
((TyFun
(Sym {co_a1jm})
<*>_N)_N
->_N <*>_N)
(Coh <c_a1ig[sk:2] xx_a1iA[tau:3]>_N
(Sym ((TyFun
<Proxy
xx_a1iA[tau:3]>_N
((TyFun
(Sym {co_a1jm})
<*>_N)_N
->_N <*>_N))_N
->_N <*>_N)))
<'Proxy>_N)_N)
(Sym ((TyFun
(Sym {co_a1jm})
<*>_N)_N
->_N <*>_N)))
(Coh <yy_a1iB[tau:3]>_N
{co_a1jm}))_N))_N
->_N <*>_N))_N
->_N <*>_N))
'Proxy :: (Proxy (yy_a1iB[tau:3] |> {co_a1jm}) ~> s_a1jp[fmv:0]))
~# (s_a1jQ[fmv:0] :: (Proxy (yy_a1iB[tau:3] |> {co_a1jm})
~> s_a1jp[fmv:0]))
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1162:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcSMonad.hs:3047:25 in ghc:TcSMonad
```
On GHC 8.4.2, it simply throws an error:
```
$ /opt/ghc/8.4.2/bin/ghci Bug2.hs
GHCi, version 8.4.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug2.hs, interpreted )
Bug2.hs:53:71: error:
• Expected kind ‘Apply b xx’, but ‘y’ has kind ‘b @@ x’
• In the first argument of ‘Proxy’, namely ‘y’
In the first argument of ‘(~>)’, namely ‘Proxy y’
In the second argument of ‘(~>)’, namely
‘Proxy y ~> c @@ ( 'Proxy :: Proxy x) @@ y’
|
53 | (f :: forall (x :: a) (y :: b @@ x). Proxy x ~> Proxy y ~> c @@ ('Proxy :: Proxy x) @@ y)
| ^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| 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":"GHC HEAD panic (dischargeFmv)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics on GHC HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilyDependencies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Proxy\r\n\r\ndata family Sing (a :: k)\r\ndata SomeSing :: Type -> Type where\r\n SomeSing :: Sing (a :: k) -> SomeSing k\r\n\r\nclass SingKind k where\r\n type Demote k = (r :: Type) | r -> k\r\n fromSing :: Sing (a :: k) -> Demote k\r\n toSing :: Demote k -> SomeSing k\r\n\r\nwithSomeSing :: forall k r\r\n . SingKind k\r\n => Demote k\r\n -> (forall (a :: k). Sing a -> r)\r\n -> r\r\nwithSomeSing x f =\r\n case toSing x of\r\n SomeSing x' -> f x'\r\n\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { applySing :: forall t. Sing t -> Sing (f @@ t) }\r\n\r\ninstance (SingKind k1, SingKind k2) => SingKind (k1 ~> k2) where\r\n type Demote (k1 ~> k2) = Demote k1 -> Demote k2\r\n fromSing sFun x = withSomeSing x (fromSing . applySing sFun)\r\n toSing = undefined\r\n\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\n\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\ntype f @@ x = Apply f x\r\ninfixl 9 @@\r\n\r\ndcomp :: forall (a :: Type)\r\n (b :: a ~> Type)\r\n (c :: forall (x :: a). Proxy x ~> b @@ x ~> Type)\r\n (f :: forall (x :: a) (y :: b @@ x). Proxy x ~> Proxy y ~> c @@ ('Proxy :: Proxy x) @@ y)\r\n (g :: forall (x :: a). Proxy x ~> b @@ x)\r\n (x :: a).\r\n SingKind (c @@ ('Proxy :: Proxy x) @@ (g @@ ('Proxy :: Proxy x)))\r\n => (forall (xx :: a) (yy :: b @@ xx). Sing (f @@ ('Proxy :: Proxy xx) @@ ('Proxy :: Proxy yy)))\r\n -> Sing g\r\n -> Sing a\r\n -> Demote (c @@ ('Proxy :: Proxy x) @@ (g @@ ('Proxy :: Proxy x)))\r\ndcomp _sf _ _ = undefined\r\n}}}\r\n{{{\r\n$ /opt/ghc/head/bin/ghc Bug2.hs\r\n[1 of 1] Compiling Bug ( Bug2.hs, Bug2.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.5.20180501 for x86_64-unknown-linux):\r\n dischargeFmv\r\n [D] _ {0}:: (Apply\r\n (f_a1ih[sk:2] xx_a1iA[tau:3] yy_a1iB[tau:3] |> Sym ((TyFun\r\n <Proxy xx_a1iA[tau:3]>_N\r\n ((TyFun\r\n (Proxy\r\n (Sym {co_a1jm})\r\n (Coh <yy_a1iB[tau:3]>_N\r\n {co_a1jm}))_N\r\n (Sym {co_a1jB} ; (Apply\r\n (Sym {co_a1jm})\r\n <*>_N\r\n (Coh ((Coh <s_a1jn[fmv:0]>_N\r\n ((TyFun\r\n (Sym {co_a1jm})\r\n <*>_N)_N\r\n ->_N <*>_N) ; Sym {co_a1jA}) ; (Apply\r\n <Proxy\r\n xx_a1iA[tau:3]>_N\r\n ((TyFun\r\n (Sym {co_a1jm})\r\n <*>_N)_N\r\n ->_N <*>_N)\r\n (Coh <c_a1ig[sk:2] xx_a1iA[tau:3]>_N\r\n (Sym ((TyFun\r\n <Proxy\r\n xx_a1iA[tau:3]>_N\r\n ((TyFun\r\n (Sym {co_a1jm})\r\n <*>_N)_N\r\n ->_N <*>_N))_N\r\n ->_N <*>_N)))\r\n <'Proxy>_N)_N)\r\n (Sym ((TyFun\r\n (Sym {co_a1jm})\r\n <*>_N)_N\r\n ->_N <*>_N)))\r\n (Coh <yy_a1iB[tau:3]>_N\r\n {co_a1jm}))_N))_N\r\n ->_N <*>_N))_N\r\n ->_N <*>_N))\r\n 'Proxy :: (Proxy (yy_a1iB[tau:3] |> {co_a1jm}) ~> s_a1jp[fmv:0]))\r\n ~# (s_a1jQ[fmv:0] :: (Proxy (yy_a1iB[tau:3] |> {co_a1jm})\r\n ~> s_a1jp[fmv:0]))\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1162:37 in ghc:Outputable\r\n pprPanic, called at compiler/typecheck/TcSMonad.hs:3047:25 in ghc:TcSMonad\r\n}}}\r\n\r\nOn GHC 8.4.2, it simply throws an error:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.2/bin/ghci Bug2.hs\r\nGHCi, version 8.4.2: http://www.haskell.org/ghc/ :? for help\r\nLoaded GHCi configuration from /home/rgscott/.ghci\r\n[1 of 1] Compiling Bug ( Bug2.hs, interpreted )\r\n\r\nBug2.hs:53:71: error:\r\n • Expected kind ‘Apply b xx’, but ‘y’ has kind ‘b @@ x’\r\n • In the first argument of ‘Proxy’, namely ‘y’\r\n In the first argument of ‘(~>)’, namely ‘Proxy y’\r\n In the second argument of ‘(~>)’, namely\r\n ‘Proxy y ~> c @@ ( 'Proxy :: Proxy x) @@ y’\r\n |\r\n53 | (f :: forall (x :: a) (y :: b @@ x). Proxy x ~> Proxy y ~> c @@ ('Proxy :: Proxy x) @@ y)\r\n | ^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15175ghc: panic! (the 'impossible' happened)2021-02-14T03:05:03ZMADjesticghc: panic! (the 'impossible' happened)Hey guys,
When following the installation instructions for [SpaceInvaders](https://github.com/ivanperez-keera/SpaceInvaders/), I am getting the following error:
```
[13 of 14] Compiling ObjectBehavior ( src/ObjectBehavior.hs, dist/di...Hey guys,
When following the installation instructions for [SpaceInvaders](https://github.com/ivanperez-keera/SpaceInvaders/), I am getting the following error:
```
[13 of 14] Compiling ObjectBehavior ( src/ObjectBehavior.hs, dist/dist-sandbox-5c221c1a/build/spaceInvaders/spaceInvaders-tmp/ObjectBehavior.o )
src/ObjectBehavior.hs:20:1: warning: [-Wunused-imports]
The qualified import of ‘System.Random’ is redundant
except perhaps to import instances from ‘System.Random’
To import instances alone, use: import System.Random()
src/ObjectBehavior.hs:23:1: warning: [-Wunused-imports]
The import of ‘FRP.Yampa.Integration’ is redundant
except perhaps to import instances from ‘FRP.Yampa.Integration’
To import instances alone, use: import FRP.Yampa.Integration()
src/ObjectBehavior.hs:24:1: warning: [-Wunused-imports]
The import of ‘FRP.Yampa.Utilities’ is redundant
except perhaps to import instances from ‘FRP.Yampa.Utilities’
To import instances alone, use: import FRP.Yampa.Utilities()
src/ObjectBehavior.hs:256:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature:
gravity :: Vector2 Velocity
src/ObjectBehavior.hs:263:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature:
limit :: Ord a => a -> a -> a -> a
src/ObjectBehavior.hs:265:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature:
symLimit :: (Num t, Ord t) => t -> t -> t
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
StgCmmEnv: variable not found
$dNum_aoyU
local binds for:
$s$fVectorSpaceVector2a_$s$fVectorSpaceVector2a_$cnorm
$s$fVectorSpaceVector2a_$s$fVectorSpaceVector2a_$cp1VectorSpace
$sintegralAux_rsVn
integralAux_rsVo
lvl_rsVp
lvl1_rsVq
lvl2_rsVr
lvl3_rsVs
$sintegralAux1_rsVt
integralAux1_rsVu
$sintegralAux2_rsVv
integralAux2_rsVw
lvl4_rsVx
lvl5_rsVy
lvl6_rsVz
lvl7_rsVA
lvl8_rsVB
lvl9_rsVC
lvl10_rsVD
lvl11_rsVE
lvl13_rsVM
lvl14_rsVN
lvl15_rsVO
lvl16_rsVP
lvl17_rsVQ
lvl18_rsVR
lvl19_rsVS
lvl20_rsVT
lvl21_rsVU
lvl22_rsVV
lvl23_rsVW
lvl24_rsVX
lvl25_rsVY
dt_rsVZ
dt1_rsW0
sf_rsW1
dt2_rsW2
lvl26_rsW3
lvl27_rsW4
lvl28_rsW5
lvl29_rsW6
lvl30_rsW7
lvl31_rsW8
lvl32_rsW9
lvl33_rsWa
lvl34_rsWb
lvl35_rsWc
lvl36_rsWd
lvl37_rsWe
lvl38_rsWf
lvl39_rsWg
lvl40_rsWh
lvl41_rsWi
lvl42_rsWj
lvl43_rsWk
lvl44_rsWl
lvl45_rsWm
lvl46_rsWn
lvl47_rsWo
lvl48_rsWp
lvl49_rsWq
lvl50_rsWr
lvl51_rsWs
lvl52_rsWt
lvl53_rsWu
lvl54_rsWv
lvl55_rsWw
lvl56_rsWx
lvl57_rsWy
lvl58_rsWz
lvl59_rsWA
lvl60_rsWB
lvl61_rsWC
lvl62_rsWD
lvl63_rsWE
lvl64_rsWF
$sintegralAux3_rsWG
integralAux5_rsWH
ll_rsWI
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
[/original issue](https://github.com/ivanperez-keera/SpaceInvaders/issues/30#issuecomment-390638740)
```
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.0.2
$ uname -a
Linux nu 4.9.95-gentoo #1 SMP PREEMPT Wed May 9 22:32:30 CEST 2018 x86_64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz GenuineIntel GNU/Linux
```
<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 | Linux |
| Architecture | x86_64 (amd64) |
</details>
<!-- {"blocked_by":[],"summary":"ghc: panic! (the 'impossible' happened)","status":"New","operating_system":"Linux","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"x86_64 (amd64)","cc":[""],"type":"Bug","description":"Hey guys,\r\n\r\nWhen following the installation instructions for [https://github.com/ivanperez-keera/SpaceInvaders/ SpaceInvaders], I am getting the following error:\r\n\r\n\r\n{{{\r\n[13 of 14] Compiling ObjectBehavior ( src/ObjectBehavior.hs, dist/dist-sandbox-5c221c1a/build/spaceInvaders/spaceInvaders-tmp/ObjectBehavior.o )\r\n\r\nsrc/ObjectBehavior.hs:20:1: warning: [-Wunused-imports]\r\n The qualified import of ‘System.Random’ is redundant\r\n except perhaps to import instances from ‘System.Random’\r\n To import instances alone, use: import System.Random()\r\n\r\nsrc/ObjectBehavior.hs:23:1: warning: [-Wunused-imports]\r\n The import of ‘FRP.Yampa.Integration’ is redundant\r\n except perhaps to import instances from ‘FRP.Yampa.Integration’\r\n To import instances alone, use: import FRP.Yampa.Integration()\r\n\r\nsrc/ObjectBehavior.hs:24:1: warning: [-Wunused-imports]\r\n The import of ‘FRP.Yampa.Utilities’ is redundant\r\n except perhaps to import instances from ‘FRP.Yampa.Utilities’\r\n To import instances alone, use: import FRP.Yampa.Utilities()\r\n\r\nsrc/ObjectBehavior.hs:256:1: warning: [-Wmissing-signatures]\r\n Top-level binding with no type signature:\r\n gravity :: Vector2 Velocity\r\n\r\nsrc/ObjectBehavior.hs:263:1: warning: [-Wmissing-signatures]\r\n Top-level binding with no type signature:\r\n limit :: Ord a => a -> a -> a -> a\r\n\r\nsrc/ObjectBehavior.hs:265:1: warning: [-Wmissing-signatures]\r\n Top-level binding with no type signature:\r\n symLimit :: (Num t, Ord t) => t -> t -> t\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.0.2 for x86_64-unknown-linux):\r\n\tStgCmmEnv: variable not found\r\n $dNum_aoyU\r\n local binds for:\r\n $s$fVectorSpaceVector2a_$s$fVectorSpaceVector2a_$cnorm\r\n $s$fVectorSpaceVector2a_$s$fVectorSpaceVector2a_$cp1VectorSpace\r\n $sintegralAux_rsVn\r\n integralAux_rsVo\r\n lvl_rsVp\r\n lvl1_rsVq\r\n lvl2_rsVr\r\n lvl3_rsVs\r\n $sintegralAux1_rsVt\r\n integralAux1_rsVu\r\n $sintegralAux2_rsVv\r\n integralAux2_rsVw\r\n lvl4_rsVx\r\n lvl5_rsVy\r\n lvl6_rsVz\r\n lvl7_rsVA\r\n lvl8_rsVB\r\n lvl9_rsVC\r\n lvl10_rsVD\r\n lvl11_rsVE\r\n lvl13_rsVM\r\n lvl14_rsVN\r\n lvl15_rsVO\r\n lvl16_rsVP\r\n lvl17_rsVQ\r\n lvl18_rsVR\r\n lvl19_rsVS\r\n lvl20_rsVT\r\n lvl21_rsVU\r\n lvl22_rsVV\r\n lvl23_rsVW\r\n lvl24_rsVX\r\n lvl25_rsVY\r\n dt_rsVZ\r\n dt1_rsW0\r\n sf_rsW1\r\n dt2_rsW2\r\n lvl26_rsW3\r\n lvl27_rsW4\r\n lvl28_rsW5\r\n lvl29_rsW6\r\n lvl30_rsW7\r\n lvl31_rsW8\r\n lvl32_rsW9\r\n lvl33_rsWa\r\n lvl34_rsWb\r\n lvl35_rsWc\r\n lvl36_rsWd\r\n lvl37_rsWe\r\n lvl38_rsWf\r\n lvl39_rsWg\r\n lvl40_rsWh\r\n lvl41_rsWi\r\n lvl42_rsWj\r\n lvl43_rsWk\r\n lvl44_rsWl\r\n lvl45_rsWm\r\n lvl46_rsWn\r\n lvl47_rsWo\r\n lvl48_rsWp\r\n lvl49_rsWq\r\n lvl50_rsWr\r\n lvl51_rsWs\r\n lvl52_rsWt\r\n lvl53_rsWu\r\n lvl54_rsWv\r\n lvl55_rsWw\r\n lvl56_rsWx\r\n lvl57_rsWy\r\n lvl58_rsWz\r\n lvl59_rsWA\r\n lvl60_rsWB\r\n lvl61_rsWC\r\n lvl62_rsWD\r\n lvl63_rsWE\r\n lvl64_rsWF\r\n $sintegralAux3_rsWG\r\n integralAux5_rsWH\r\n ll_rsWI\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\n[https://github.com/ivanperez-keera/SpaceInvaders/issues/30#issuecomment-390638740 /original issue]\r\n\r\n{{{\r\n$ ghc -V\r\nThe Glorious Glasgow Haskell Compilation System, version 8.0.2\r\n $ uname -a\r\nLinux nu 4.9.95-gentoo #1 SMP PREEMPT Wed May 9 22:32:30 CEST 2018 x86_64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz GenuineIntel GNU/Linux\r\n}}}\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15186ghc 8.4.2 panic in profiling build2019-07-07T18:13:52Zkquickghc 8.4.2 panic in profiling buildWhen building our crucible-llvm library (https://github.com/GaloisInc/crucible) with profiling enabled, we encounter the following:
```
[19 of 21] Compiling Lang.Crucible.LLVM.Translation ( src/Lang/Crucible/LLVM/Translation.hs, dist/bu...When building our crucible-llvm library (https://github.com/GaloisInc/crucible) with profiling enabled, we encounter the following:
```
[19 of 21] Compiling Lang.Crucible.LLVM.Translation ( src/Lang/Crucible/LLVM/Translation.hs, dist/build/Lang/Crucible/LLVM/Translation.p_o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.2 for x86_64-unknown-linux):
isUnliftedType
r_a4IqS :: TYPE rep_a4IqR
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1939:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Procedure to reproduce:
```
$ git clone https://github.com/GaloisInc/crucible
$ cd crucible/crucible-llvm
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.2
$ cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.0 of the Cabal library
$ cabal configure --enable-library-profiling
$ cabal build
```
Note: the llvm-pretty dependency on Hackage is not compatible with GHC 8.4.2; use the latest from the github repo at http://github.com/elliottt/llvm-pretty. The crucible and what4 dependencies come from sibling subdirectories in the same crucible checkout.
This builds successfully when using GHC 8.2.2 instead.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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 8.4.2 panic in profiling build","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When building our crucible-llvm library (https://github.com/GaloisInc/crucible) with profiling enabled, we encounter the following:\r\n\r\n{{{\r\n[19 of 21] Compiling Lang.Crucible.LLVM.Translation ( src/Lang/Crucible/LLVM/Translation.hs, dist/build/Lang/Crucible/LLVM/Translation.p_o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.2 for x86_64-unknown-linux):\r\n isUnliftedType\r\n r_a4IqS :: TYPE rep_a4IqR\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/types/Type.hs:1939:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nProcedure to reproduce:\r\n{{{\r\n$ git clone https://github.com/GaloisInc/crucible\r\n$ cd crucible/crucible-llvm\r\n$ ghc --version\r\nThe Glorious Glasgow Haskell Compilation System, version 8.4.2\r\n$ cabal --version\r\ncabal-install version 2.0.0.1\r\ncompiled using version 2.0.1.0 of the Cabal library\r\n$ cabal configure --enable-library-profiling\r\n$ cabal build\r\n}}}\r\n\r\nNote: the llvm-pretty dependency on Hackage is not compatible with GHC 8.4.2; use the latest from the github repo at http://github.com/elliottt/llvm-pretty. The crucible and what4 dependencies come from sibling subdirectories in the same crucible checkout.\r\n\r\nThis builds successfully when using GHC 8.2.2 instead.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/15202Internal error showing typed hole in GHCi2019-07-07T18:13:49ZDavid FeuerInternal error showing typed hole in GHCiRun `ghc --interactive`, and at the prompt type
```hs
default ()
fish :: Eq a => a; fish = undefined
foo :: String; foo = show _
```
The following error appears:
```
<interactive>:1:1: error:
GHC internal error: ‘Ghci1.$trModule’ ...Run `ghc --interactive`, and at the prompt type
```hs
default ()
fish :: Eq a => a; fish = undefined
foo :: String; foo = show _
```
The following error appears:
```
<interactive>:1:1: error:
GHC internal error: ‘Ghci1.$trModule’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: [r2CZ :-> Identifier[foo::String, TopLevelLet]]
```
I have not yet been able to reproduce this loading a module; it seems to need to be on the command line.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| 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":"Internal error showing typed hole in GHCi","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypedHoles"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Run `ghc --interactive`, and at the prompt type\r\n\r\n{{{#!hs\r\ndefault ()\r\nfish :: Eq a => a; fish = undefined\r\nfoo :: String; foo = show _\r\n}}}\r\n\r\nThe following error appears:\r\n\r\n{{{\r\n<interactive>:1:1: error:\r\n GHC internal error: ‘Ghci1.$trModule’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: [r2CZ :-> Identifier[foo::String, TopLevelLet]]\r\n}}}\r\n\r\nI have not yet been able to reproduce this loading a module; it seems to need to be on the command line.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15215GHC HEAD internal error when FlexibleContexts isn't enabled2019-07-07T18:13:45ZRyan ScottGHC HEAD internal error when FlexibleContexts isn't enabledThe following code produces a GHC internal error on GHC HEAD:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
data A :: Type -> Type where
MkA :: Show (...The following code produces a GHC internal error on GHC HEAD:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeInType #-}
module Bug where
import Data.Kind
data A :: Type -> Type where
MkA :: Show (Maybe a) => A a
data SA :: forall a. A a -> Type where
SMkA :: SA MkA
```
```
$ ~/Software/ghc5/inplace/bin/ghc-stage2 Bug.hs[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:9:3: error:
• Non type-variable argument in the constraint: Show (Maybe a)
(Use FlexibleContexts to permit this)
• In the definition of data constructor ‘MkA’
In the data type declaration for ‘A’
|
9 | MkA :: Show (Maybe a) => A a
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:12:14: error:
• GHC internal error: ‘MkA’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: [rqU :-> ATcTyCon SA :: forall a. A a -> *,
rsV :-> APromotionErr RecDataConPE]
• In the first argument of ‘SA’, namely ‘MkA’
In the type ‘SA MkA’
In the definition of data constructor ‘SMkA’
|
12 | SMkA :: SA MkA
| ^^^
```
Enabling `FlexibleContexts` causes the internal error to go away.
This is a regression from GHC 8.4, which does not give an internal error.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.3 |
| Type | Bug |
| 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":"GHC HEAD internal error when FlexibleContexts isn't enabled","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following code produces a GHC internal error on GHC HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeInType #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ndata A :: Type -> Type where\r\n MkA :: Show (Maybe a) => A a\r\n\r\ndata SA :: forall a. A a -> Type where\r\n SMkA :: SA MkA\r\n}}}\r\n{{{\r\n$ ~/Software/ghc5/inplace/bin/ghc-stage2 Bug.hs[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:9:3: error:\r\n • Non type-variable argument in the constraint: Show (Maybe a)\r\n (Use FlexibleContexts to permit this)\r\n • In the definition of data constructor ‘MkA’\r\n In the data type declaration for ‘A’\r\n |\r\n9 | MkA :: Show (Maybe a) => A a\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nBug.hs:12:14: error:\r\n • GHC internal error: ‘MkA’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: [rqU :-> ATcTyCon SA :: forall a. A a -> *,\r\n rsV :-> APromotionErr RecDataConPE]\r\n • In the first argument of ‘SA’, namely ‘MkA’\r\n In the type ‘SA MkA’\r\n In the definition of data constructor ‘SMkA’\r\n |\r\n12 | SMkA :: SA MkA\r\n | ^^^\r\n}}}\r\n\r\nEnabling `FlexibleContexts` causes the internal error to go away.\r\n\r\nThis is a regression from GHC 8.4, which does not give an internal error.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15262GHC and iserv cannot agree on what an Integer is; insanity ensues2020-06-19T14:35:19ZhowtonotwinGHC and iserv cannot agree on what an Integer is; insanity ensuesTested off `ghc-8.6.1-alpha1`, running on macOS 10.13.5.
1. Compile a GHC that uses `integer-gmp`.
2. Compile a GHC that uses `integer-simple`.
3. Make `Main.hs`:
> ```haskell
> {-# LANGUAGE TemplateHaskell #-}
...Tested off `ghc-8.6.1-alpha1`, running on macOS 10.13.5.
1. Compile a GHC that uses `integer-gmp`.
2. Compile a GHC that uses `integer-simple`.
3. Make `Main.hs`:
> ```haskell
> {-# LANGUAGE TemplateHaskell #-}
> main = print $([e| 0 |])
> ```
4. Try to compile the file with `integer-gmp` `ghc` and `integer-simple` `ghc-iserv`.
* Expected behavior: (compiles fine and executable prints `0`) or (outputs to-the-point error message)
* Actual:
```none
[1 of 1] Compiling Main ( Main.hs, Main.o )
Main.hs:2:14: error:
• Exception when trying to run compile-time code:
ghc: ghc-iserv terminated (-11)
Code: [| 0 |]
• In the untyped splice: $([| 0 |])
|
2 | main = print $([e| 0 |])
| ^^^^^^^^^^^
```
4. Try to compile the file with `integer-simple` `ghc` and `integer-gmp` `ghc-iserv`.
* Expected behavior: (compiles fine and executable prints `0`) or (outputs to-the-point error message)
* Actual:
```none
[1 of 1] Compiling Main ( Main.hs, Main.o )
Main.hs:2:14: error:
• Exception when trying to run compile-time code:
heap overflow
Code: [| 0 |]
• In the untyped splice: $([| 0 |])
|
2 | main = print $([e| 0 |])
| ^^^^^^^^^^^
```
For more fun, replace the `0` with a `1`. `gmp` `ghc` + `simple` `iserv` continues to explode. This is better than `simple` `ghc` + `gmp` `iserv`:
```bash
$ ./Main
283468057265
$ ./Main
283468057265
$ $simple_ghc -fexternal-interpreter -pgmi=$gmp_iserv Main.hs # again
# ...
$ ./Main
283468057105
```
Absolutely delicious. There is a similar situation for fractional literals.
It would be nice if there were at least a warning for situations like this.9.0.1John EricsonJohn Ericsonhttps://gitlab.haskell.org/ghc/ghc/-/issues/15280StgCmmEnv: variable not found2019-07-07T18:13:28ZwanjachStgCmmEnv: variable not found```
stack build
warduino-0.1.0.0: build (lib + exe)
Preprocessing library warduino-0.1.0.0...
Preprocessing executable 'blink' for warduino-0.1.0.0...
Preprocessing executable 'lcd' for warduino-0.1.0.0...
[1 of 1] Compiling Main ...```
stack build
warduino-0.1.0.0: build (lib + exe)
Preprocessing library warduino-0.1.0.0...
Preprocessing executable 'blink' for warduino-0.1.0.0...
Preprocessing executable 'lcd' for warduino-0.1.0.0...
[1 of 1] Compiling Main ( lcd/Main.hs, .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/lcd/lcd-tmp/Main.o )
/home/user/src/warduino/lcd/Main.hs:31:5: warning: [-Wname-shadowing]
This binding for `lcd' shadows the existing binding
defined at lcd/Main.hs:30:1
/home/user/src/warduino/lcd/Main.hs:33:9: warning: [-Wname-shadowing]
This binding for `print' shadows the existing binding
imported from `Prelude' at lcd/Main.hs:2:8-11
(and originally defined in `System.IO')
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
StgCmmEnv: variable not found
lcd_a3jG
local binds for:
delay_deep'1
$trModule1
$trModule2
delay
lcdController
$trModule
lcd5
lcdController1
lcdController2
lcdController3
lcdController4
lcdController5
lcdController6
lcdController7
lcd6
lcd7
lvl_r9Ee
lvl1_r9Ef
lvl2_r9Eg
lvl3_r9Eh
lvl4_r9Ei
lvl5_r9Ej
lvl6_r9Ek
lvl7_r9El
delay_deep'
ipv1_s9Ev
addr#_s9Ew
ds4_s9EA
sat_s9EB
sat_s9EC
sat_s9ED
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
-- While building custom Setup.hs for package warduino-0.1.0.0 using:
```
<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":"StgCmmEnv: variable not found","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":"{{{\r\nstack build\r\nwarduino-0.1.0.0: build (lib + exe)\r\nPreprocessing library warduino-0.1.0.0...\r\nPreprocessing executable 'blink' for warduino-0.1.0.0...\r\nPreprocessing executable 'lcd' for warduino-0.1.0.0...\r\n[1 of 1] Compiling Main ( lcd/Main.hs, .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/lcd/lcd-tmp/Main.o )\r\n\r\n/home/user/src/warduino/lcd/Main.hs:31:5: warning: [-Wname-shadowing]\r\n This binding for `lcd' shadows the existing binding\r\n defined at lcd/Main.hs:30:1\r\n\r\n/home/user/src/warduino/lcd/Main.hs:33:9: warning: [-Wname-shadowing]\r\n This binding for `print' shadows the existing binding\r\n imported from `Prelude' at lcd/Main.hs:2:8-11\r\n (and originally defined in `System.IO')\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.0.2 for x86_64-unknown-linux):\r\n StgCmmEnv: variable not found\r\n lcd_a3jG\r\n local binds for:\r\n delay_deep'1\r\n $trModule1\r\n $trModule2\r\n delay\r\n lcdController\r\n $trModule\r\n lcd5\r\n lcdController1\r\n lcdController2\r\n lcdController3\r\n lcdController4\r\n lcdController5\r\n lcdController6\r\n lcdController7\r\n lcd6\r\n lcd7\r\n lvl_r9Ee\r\n lvl1_r9Ef\r\n lvl2_r9Eg\r\n lvl3_r9Eh\r\n lvl4_r9Ei\r\n lvl5_r9Ej\r\n lvl6_r9Ek\r\n lvl7_r9El\r\n delay_deep'\r\n ipv1_s9Ev\r\n addr#_s9Ew\r\n ds4_s9EA\r\n sat_s9EB\r\n sat_s9EC\r\n sat_s9ED\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n\r\n-- While building custom Setup.hs for package warduino-0.1.0.0 using:\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15289isUnliftedType GHC panic on pattern with True :: Maybe2019-07-07T18:13:25ZRemiisUnliftedType GHC panic on pattern with True :: Maybe```hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Oops where
pattern What = True :: Maybe
```
Fails on 8.4.3 with:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-li...```hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Oops where
pattern What = True :: Maybe
```
Fails on 8.4.3 with:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
isUnliftedType
(Maybe |> {co_a1Dg3}) :: TYPE t_a1Dg9[tau:1]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1939:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
I'm currently cloning from git, and will try to get around to check it with HEAD over the next days. BTW, it's not a show-stopper for me.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | aarch64 |
</details>
<!-- {"blocked_by":[],"summary":"isUnliftedType GHC panic on pattern with True :: Maybe","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"aarch64","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# LANGUAGE PatternSynonyms #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\nmodule Oops where\r\n\r\npattern What = True :: Maybe\r\n}}}\r\n\r\nFails on 8.4.3 with:\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n\tisUnliftedType\r\n (Maybe |> {co_a1Dg3}) :: TYPE t_a1Dg9[tau:1]\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/types/Type.hs:1939:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nI'm currently cloning from git, and will try to get around to check it with HEAD over the next days. BTW, it's not a show-stopper for me.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15318Core Lint error involving newtype family instances with wrappers2019-07-07T18:13:18ZRyan ScottCore Lint error involving newtype family instances with wrappersThe following program gives a Core Lint error on GHC 8.4 and later:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
data family Sn a
newtype instance Sn (Either a b) wher...The following program gives a Core Lint error on GHC 8.4 and later:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
data family Sn a
newtype instance Sn (Either a b) where
SnC :: forall b a. Char -> Sn (Either a b)
```
```
$ /opt/ghc/8.4.3/bin/ghc -dcore-lint Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Tidy Core ***
<no location info>: warning:
[in body of lambda with binder dt_aZm :: Char]
From-type of Cast differs from type of enclosed expression
From-type: R:SnEither a_auS b_auR
Type of enclosed expr: Sn (Either a_auS b_auR)
Actual enclosed expr: dt_aZm
`cast` (Sym (N:R:SnEither[0]
<a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0]
<a_auS>_N <b_auR>_N)
:: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *))
Coercion used in cast: Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
*** Offending Program ***
$WSnC [InlPrag=INLINE[2]] :: forall b a. Char -> Sn (Either a b)
[GblId[DataConWrapper],
Arity=1,
Caf=NoCafRefs,
Str=<L,U>,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
Tmpl= \ (@ b_auR) (@ a_auS) (dt_aZm [Occ=Once] :: Char) ->
(dt_aZm
`cast` (Sym (N:R:SnEither[0]
<a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
:: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *)))
`cast` (Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
:: (R:SnEither a_auS b_auR :: *)
~R# (Sn (Either a_auS b_auR) :: *))}]
$WSnC
= \ (@ b_auR) (@ a_auS) (dt_aZm [Occ=Once] :: Char) ->
(dt_aZm
`cast` (Sym (N:R:SnEither[0]
<a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
:: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *)))
`cast` (Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
:: (R:SnEither a_auS b_auR :: *)
~R# (Sn (Either a_auS b_auR) :: *))
$trModule1_r10g :: Addr#
[GblId, Caf=NoCafRefs]
$trModule1_r10g = "main"#
$trModule2_r10D :: TrName
[GblId, Caf=NoCafRefs]
$trModule2_r10D = TrNameS $trModule1_r10g
$trModule3_r10E :: Addr#
[GblId, Caf=NoCafRefs]
$trModule3_r10E = "Bug"#
$trModule4_r10F :: TrName
[GblId, Caf=NoCafRefs]
$trModule4_r10F = TrNameS $trModule3_r10E
$trModule :: Module
[GblId, Caf=NoCafRefs]
$trModule = Module $trModule2_r10D $trModule4_r10F
$krep_r10G :: KindRep
[GblId]
$krep_r10G = KindRepTyConApp $tcChar ([] @ KindRep)
$krep1_r10H :: KindRep
[GblId, Caf=NoCafRefs]
$krep1_r10H = KindRepVar 1#
$krep2_r10I :: KindRep
[GblId, Caf=NoCafRefs]
$krep2_r10I = KindRepVar 0#
$krep3_r10J :: [KindRep]
[GblId, Caf=NoCafRefs]
$krep3_r10J = : @ KindRep $krep2_r10I ([] @ KindRep)
$krep4_r10K :: [KindRep]
[GblId, Caf=NoCafRefs]
$krep4_r10K = : @ KindRep $krep1_r10H $krep3_r10J
$krep5_r10L :: KindRep
[GblId]
$krep5_r10L = KindRepTyConApp $tcEither $krep4_r10K
$tcSn1_r10M :: Addr#
[GblId, Caf=NoCafRefs]
$tcSn1_r10M = "Sn"#
$tcSn2_r10N :: TrName
[GblId, Caf=NoCafRefs]
$tcSn2_r10N = TrNameS $tcSn1_r10M
$tcSn :: TyCon
[GblId]
$tcSn
= TyCon
461968091845555535##
16320521938866097056##
$trModule
$tcSn2_r10N
0#
krep$*Arr*
$krep6_r10O :: [KindRep]
[GblId]
$krep6_r10O = : @ KindRep $krep5_r10L ([] @ KindRep)
$krep7_r10P :: KindRep
[GblId]
$krep7_r10P = KindRepTyConApp $tcSn $krep6_r10O
$krep8_r10Q :: KindRep
[GblId]
$krep8_r10Q = KindRepFun $krep_r10G $krep7_r10P
$tc'SnC1_r10R :: Addr#
[GblId, Caf=NoCafRefs]
$tc'SnC1_r10R = "'SnC"#
$tc'SnC2_r10S :: TrName
[GblId, Caf=NoCafRefs]
$tc'SnC2_r10S = TrNameS $tc'SnC1_r10R
$tc'SnC :: TyCon
[GblId]
$tc'SnC
= TyCon
3818830880305712792##
17484539998814842835##
$trModule
$tc'SnC2_r10S
2#
$krep8_r10Q
*** End of Offense ***
<no location info>: error:
Compilation had errors
```
If we look at the Core for `$WSnC`, we see the culprit:
```
$WSnC
= \ (@ b_auR) (@ a_auS) (dt_aZm [Occ=Once] :: Char) ->
(dt_aZm
`cast` (Sym (N:R:SnEither[0]
<a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
:: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *)))
`cast` (Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)
:: (R:SnEither a_auS b_auR :: *)
~R# (Sn (Either a_auS b_auR) :: *))
```
The inner cast goes from `Char` to `Sn (Either a b)`, but then the outer cast goes from `R:SnEither a b` to `Sn (Either a b)`, which is not transitive.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | mpickering |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Core Lint error involving newtype family instances with wrappers","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["TypeFamilies"],"differentials":[],"test_case":"","architecture":"","cc":["mpickering"],"type":"Bug","description":"The following program gives a Core Lint error on GHC 8.4 and later:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\nmodule Bug where\r\n\r\ndata family Sn a\r\nnewtype instance Sn (Either a b) where\r\n SnC :: forall b a. Char -> Sn (Either a b)\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc -dcore-lint Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Tidy Core ***\r\n<no location info>: warning:\r\n [in body of lambda with binder dt_aZm :: Char]\r\n From-type of Cast differs from type of enclosed expression\r\n From-type: R:SnEither a_auS b_auR\r\n Type of enclosed expr: Sn (Either a_auS b_auR)\r\n Actual enclosed expr: dt_aZm\r\n `cast` (Sym (N:R:SnEither[0]\r\n <a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0]\r\n <a_auS>_N <b_auR>_N)\r\n :: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *))\r\n Coercion used in cast: Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n*** Offending Program ***\r\n$WSnC [InlPrag=INLINE[2]] :: forall b a. Char -> Sn (Either a b)\r\n[GblId[DataConWrapper],\r\n Arity=1,\r\n Caf=NoCafRefs,\r\n Str=<L,U>,\r\n Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)\r\n Tmpl= \\ (@ b_auR) (@ a_auS) (dt_aZm [Occ=Once] :: Char) ->\r\n (dt_aZm\r\n `cast` (Sym (N:R:SnEither[0]\r\n <a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n :: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *)))\r\n `cast` (Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n :: (R:SnEither a_auS b_auR :: *)\r\n ~R# (Sn (Either a_auS b_auR) :: *))}]\r\n$WSnC\r\n = \\ (@ b_auR) (@ a_auS) (dt_aZm [Occ=Once] :: Char) ->\r\n (dt_aZm\r\n `cast` (Sym (N:R:SnEither[0]\r\n <a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n :: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *)))\r\n `cast` (Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n :: (R:SnEither a_auS b_auR :: *)\r\n ~R# (Sn (Either a_auS b_auR) :: *))\r\n\r\n$trModule1_r10g :: Addr#\r\n[GblId, Caf=NoCafRefs]\r\n$trModule1_r10g = \"main\"#\r\n\r\n$trModule2_r10D :: TrName\r\n[GblId, Caf=NoCafRefs]\r\n$trModule2_r10D = TrNameS $trModule1_r10g\r\n\r\n$trModule3_r10E :: Addr#\r\n[GblId, Caf=NoCafRefs]\r\n$trModule3_r10E = \"Bug\"#\r\n\r\n$trModule4_r10F :: TrName\r\n[GblId, Caf=NoCafRefs]\r\n$trModule4_r10F = TrNameS $trModule3_r10E\r\n\r\n$trModule :: Module\r\n[GblId, Caf=NoCafRefs]\r\n$trModule = Module $trModule2_r10D $trModule4_r10F\r\n\r\n$krep_r10G :: KindRep\r\n[GblId]\r\n$krep_r10G = KindRepTyConApp $tcChar ([] @ KindRep)\r\n\r\n$krep1_r10H :: KindRep\r\n[GblId, Caf=NoCafRefs]\r\n$krep1_r10H = KindRepVar 1#\r\n\r\n$krep2_r10I :: KindRep\r\n[GblId, Caf=NoCafRefs]\r\n$krep2_r10I = KindRepVar 0#\r\n\r\n$krep3_r10J :: [KindRep]\r\n[GblId, Caf=NoCafRefs]\r\n$krep3_r10J = : @ KindRep $krep2_r10I ([] @ KindRep)\r\n\r\n$krep4_r10K :: [KindRep]\r\n[GblId, Caf=NoCafRefs]\r\n$krep4_r10K = : @ KindRep $krep1_r10H $krep3_r10J\r\n\r\n$krep5_r10L :: KindRep\r\n[GblId]\r\n$krep5_r10L = KindRepTyConApp $tcEither $krep4_r10K\r\n\r\n$tcSn1_r10M :: Addr#\r\n[GblId, Caf=NoCafRefs]\r\n$tcSn1_r10M = \"Sn\"#\r\n\r\n$tcSn2_r10N :: TrName\r\n[GblId, Caf=NoCafRefs]\r\n$tcSn2_r10N = TrNameS $tcSn1_r10M\r\n\r\n$tcSn :: TyCon\r\n[GblId]\r\n$tcSn\r\n = TyCon\r\n 461968091845555535##\r\n 16320521938866097056##\r\n $trModule\r\n $tcSn2_r10N\r\n 0#\r\n krep$*Arr*\r\n\r\n$krep6_r10O :: [KindRep]\r\n[GblId]\r\n$krep6_r10O = : @ KindRep $krep5_r10L ([] @ KindRep)\r\n\r\n$krep7_r10P :: KindRep\r\n[GblId]\r\n$krep7_r10P = KindRepTyConApp $tcSn $krep6_r10O\r\n\r\n$krep8_r10Q :: KindRep\r\n[GblId]\r\n$krep8_r10Q = KindRepFun $krep_r10G $krep7_r10P\r\n\r\n$tc'SnC1_r10R :: Addr#\r\n[GblId, Caf=NoCafRefs]\r\n$tc'SnC1_r10R = \"'SnC\"#\r\n\r\n$tc'SnC2_r10S :: TrName\r\n[GblId, Caf=NoCafRefs]\r\n$tc'SnC2_r10S = TrNameS $tc'SnC1_r10R\r\n\r\n$tc'SnC :: TyCon\r\n[GblId]\r\n$tc'SnC\r\n = TyCon\r\n 3818830880305712792##\r\n 17484539998814842835##\r\n $trModule\r\n $tc'SnC2_r10S\r\n 2#\r\n $krep8_r10Q\r\n\r\n*** End of Offense ***\r\n\r\n\r\n<no location info>: error: \r\nCompilation had errors\r\n}}}\r\n\r\nIf we look at the Core for `$WSnC`, we see the culprit:\r\n\r\n{{{\r\n$WSnC\r\n = \\ (@ b_auR) (@ a_auS) (dt_aZm [Occ=Once] :: Char) ->\r\n (dt_aZm\r\n `cast` (Sym (N:R:SnEither[0]\r\n <a_auS>_N <b_auR>_N) ; Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n :: (Char :: *) ~R# (Sn (Either a_auS b_auR) :: *)))\r\n `cast` (Sym (D:R:SnEither0[0] <a_auS>_N <b_auR>_N)\r\n :: (R:SnEither a_auS b_auR :: *)\r\n ~R# (Sn (Either a_auS b_auR) :: *))\r\n}}}\r\n\r\nThe inner cast goes from `Char` to `Sn (Either a b)`, but then the outer cast goes from `R:SnEither a b` to `Sn (Either a b)`, which is not transitive.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15325GHCi panic in getIdFromTrivialExpr with -fdefer-type-errors2020-11-18T11:28:48ZdramforeverGHCi panic in getIdFromTrivialExpr with -fdefer-type-errors## Steps to reproduce:
Put this in `bug.hs`: (It's a very failed attempt to make a polymorphic list maker function.)
```hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module ...## Steps to reproduce:
Put this in `bug.hs`: (It's a very failed attempt to make a polymorphic list maker function.)
```hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module PolyvariadicFunctions where
class PolyList e a where
polyList :: ([e] -> [e]) -> a
-- instance PolyList e [e] where
-- polyList dl = dl []
instance (e ~ e2, PolyList e a) => PolyList e (e2 -> a) where
polyList dl x = polyList ((x :) . dl)
plh :: [Integer]
plh = polyList 1 2 3 4 5
```
Load it in GHCi with `-fdefer-type-errors` to get the following output. Note the 'panic' in the end, and also note that the last `>` line is a no-module-loaded GHCi prompt.
The question marks `?` seem to be encoding related and not relevant.
This panic not seem to occur with GHC the compiler. The rest of the error messages seem otherwise identical.
```
GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help
Prelude> :set -fdefer-type-errors
Prelude> :l bug.hs
[1 of 1] Compiling PolyvariadicFunctions ( bug.hs, interpreted )
bug.hs:17:7: warning: [-Wdeferred-type-errors]
? No instance for (PolyList t0 [Integer])
arising from a use of ‘polyList’
? In the expression: polyList 1 2 3 4 5
In an equation for ‘plh’: plh = polyList 1 2 3 4 5
|
17 | plh = polyList 1 2 3 4 5
| ^^^^^^^^^^^^^^^^^^
bug.hs:17:16: warning: [-Wdeferred-type-errors]
? No instance for (Num ([t0] -> [t0])) arising from the literal ‘1’
(maybe you haven't applied a function to enough arguments?)
? In the first argument of ‘polyList’, namely ‘1’
In the expression: polyList 1 2 3 4 5
In an equation for ‘plh’: plh = polyList 1 2 3 4 5
|
17 | plh = polyList 1 2 3 4 5
| ^
bug.hs:17:18: warning: [-Wdeferred-type-errors]
? Ambiguous type variable ‘t0’ arising from the literal ‘2’
prevents the constraint ‘(Num t0)’ from being solved.
Probable fix: use a type annotation to specify what ‘t0’ should be.
These potential instances exist:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
...plus two others
(use -fprint-potential-instances to see them all)
? In the second argument of ‘polyList’, namely ‘2’
In the expression: polyList 1 2 3 4 5
In an equation for ‘plh’: plh = polyList 1 2 3 4 5
|
17 | plh = polyList 1 2 3 4 5
| ^
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-mingw32):
getIdFromTrivialExpr
case $dNum_a1Be of wild_00 { }
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler\\coreSyn\\CoreUtils.hs:883:18 in ghc:CoreUtils
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Panic in getIdFromTrivialExpr with -fdefer-type-errors","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"== Steps to reproduce:\r\n\r\nPut this in `bug.hs`: (It's a very failed attempt to make a polymorphic list maker function.)\r\n\r\n{{{#!hs\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\nmodule PolyvariadicFunctions where\r\n\r\nclass PolyList e a where\r\n polyList :: ([e] -> [e]) -> a\r\n\r\n-- instance PolyList e [e] where\r\n-- polyList dl = dl []\r\n\r\ninstance (e ~ e2, PolyList e a) => PolyList e (e2 -> a) where\r\n polyList dl x = polyList ((x :) . dl)\r\n\r\nplh :: [Integer]\r\nplh = polyList 1 2 3 4 5\r\n}}}\r\n\r\nLoad it in GHCi with `-fdefer-type-errors` to get the following output. Note the 'panic' in the end, and also note that the last `>` line is a no-module-loaded GHCi prompt.\r\n\r\nThe question marks `?` seem to be encoding related and not relevant.\r\n\r\nThis panic not seem to occur with GHC the compiler. The rest of the error messages seem otherwise identical.\r\n\r\n{{{\r\nGHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :set -fdefer-type-errors\r\nPrelude> :l bug.hs\r\n[1 of 1] Compiling PolyvariadicFunctions ( bug.hs, interpreted )\r\n\r\nbug.hs:17:7: warning: [-Wdeferred-type-errors]\r\n ? No instance for (PolyList t0 [Integer])\r\n arising from a use of ‘polyList’\r\n ? In the expression: polyList 1 2 3 4 5\r\n In an equation for ‘plh’: plh = polyList 1 2 3 4 5\r\n |\r\n17 | plh = polyList 1 2 3 4 5\r\n | ^^^^^^^^^^^^^^^^^^\r\n\r\nbug.hs:17:16: warning: [-Wdeferred-type-errors]\r\n ? No instance for (Num ([t0] -> [t0])) arising from the literal ‘1’\r\n (maybe you haven't applied a function to enough arguments?)\r\n ? In the first argument of ‘polyList’, namely ‘1’\r\n In the expression: polyList 1 2 3 4 5\r\n In an equation for ‘plh’: plh = polyList 1 2 3 4 5\r\n |\r\n17 | plh = polyList 1 2 3 4 5\r\n | ^\r\n\r\nbug.hs:17:18: warning: [-Wdeferred-type-errors]\r\n ? Ambiguous type variable ‘t0’ arising from the literal ‘2’\r\n prevents the constraint ‘(Num t0)’ from being solved.\r\n Probable fix: use a type annotation to specify what ‘t0’ should be.\r\n These potential instances exist:\r\n instance Num Integer -- Defined in ‘GHC.Num’\r\n instance Num Double -- Defined in ‘GHC.Float’\r\n instance Num Float -- Defined in ‘GHC.Float’\r\n ...plus two others\r\n (use -fprint-potential-instances to see them all)\r\n ? In the second argument of ‘polyList’, namely ‘2’\r\n In the expression: polyList 1 2 3 4 5\r\n In an equation for ‘plh’: plh = polyList 1 2 3 4 5\r\n |\r\n17 | plh = polyList 1 2 3 4 5\r\n | ^\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-mingw32):\r\n getIdFromTrivialExpr\r\n case $dNum_a1Be of wild_00 { }\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\\\\coreSyn\\\\CoreUtils.hs:883:18 in ghc:CoreUtils\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n>\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15343Implicitly quantifying a kind variable causes GHC 8.6 to panic (coercionKind)2019-07-07T18:13:05ZRyan ScottImplicitly quantifying a kind variable causes GHC 8.6 to panic (coercionKind)The following program panics on GHC 8.6 and later:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFam...The following program panics on GHC 8.6 and later:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
import Data.Type.Equality
data family Sing :: forall k. k -> Type
data SomeSing :: Type -> Type where
SomeSing :: Sing (a :: k) -> SomeSing k
class SingKind k where
type Demote k :: Type
fromSing :: Sing (a :: k) -> Demote k
toSing :: Demote k -> SomeSing k
data instance Sing (z :: a :~~: b) where
SHRefl :: Sing HRefl
instance SingKind (a :~~: b) where
type Demote (a :~~: b) = a :~~: b
fromSing SHRefl = HRefl
toSing HRefl = SomeSing SHRefl
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
(~>:~~:) :: forall (j :: Type) (k :: Type) (a :: j) (b :: k)
(p :: forall (z :: Type) (y :: z). (a :~~: y) ~> Type)
(r :: a :~~: b).
Sing r
-> Apply p HRefl
-> Apply p r
(~>:~~:) SHRefl pHRefl = pHRefl
type family Why (a :: j) (e :: a :~~: (y :: z)) :: Type where
Why a (_ :: a :~~: y) = y :~~: a
data WhySym (a :: j) :: forall (y :: z). (a :~~: y) ~> Type
-- data WhySym (a :: j) :: forall z (y :: z). (a :~~: y) ~> Type
-- The version above does NOT panic
type instance Apply (WhySym a) e = Why a e
hsym :: forall (j :: Type) (k :: Type) (a :: j) (b :: k).
a :~~: b -> b :~~: a
hsym eq = case toSing eq of
SomeSing (singEq :: Sing r) ->
(~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180627 for x86_64-unknown-linux):
coercionKind
Nth:3
(Inst {co_a1jI} (Coh <k_a1js[sk:1]>_N (Nth:0 (Sym {co_a1jI}))))
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable
pprPanic, called at compiler/types/Coercion.hs:1887:9 in ghc:Coercion
```
As noted in the comments, replacing `WhySym` with a version that explicitly quantifies `z` avoids the panic.
This is a regression from GHC 8.4.3, in which the program simply errored:
```
$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:56:38: error:
• Expected kind ‘forall z (y :: z). (a1 :~~: y) ~> *’,
but ‘WhySym a’ has kind ‘forall (y :: z0).
TyFun (a1 :~~: y) * -> *’
• In the type ‘(WhySym a)’
In the expression: (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl
In a case alternative:
SomeSing (singEq :: Sing r)
-> (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl
• Relevant bindings include
singEq :: Sing a2 (bound at Bug.hs:55:23)
eq :: a1 :~~: b (bound at Bug.hs:54:6)
hsym :: (a1 :~~: b) -> b :~~: a1 (bound at Bug.hs:54:1)
|
56 | (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl
| ^^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| 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":"Implicitly quantifying a kind variable causes GHC 8.6 to panic (coercionKind)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics on GHC 8.6 and later:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Type.Equality\r\n\r\ndata family Sing :: forall k. k -> Type\r\ndata SomeSing :: Type -> Type where\r\n SomeSing :: Sing (a :: k) -> SomeSing k\r\n\r\nclass SingKind k where\r\n type Demote k :: Type\r\n fromSing :: Sing (a :: k) -> Demote k\r\n toSing :: Demote k -> SomeSing k\r\n\r\ndata instance Sing (z :: a :~~: b) where\r\n SHRefl :: Sing HRefl\r\n\r\ninstance SingKind (a :~~: b) where\r\n type Demote (a :~~: b) = a :~~: b\r\n fromSing SHRefl = HRefl\r\n toSing HRefl = SomeSing SHRefl\r\n\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\n\r\n(~>:~~:) :: forall (j :: Type) (k :: Type) (a :: j) (b :: k)\r\n (p :: forall (z :: Type) (y :: z). (a :~~: y) ~> Type)\r\n (r :: a :~~: b).\r\n Sing r\r\n -> Apply p HRefl\r\n -> Apply p r\r\n(~>:~~:) SHRefl pHRefl = pHRefl\r\n\r\ntype family Why (a :: j) (e :: a :~~: (y :: z)) :: Type where\r\n Why a (_ :: a :~~: y) = y :~~: a\r\n\r\ndata WhySym (a :: j) :: forall (y :: z). (a :~~: y) ~> Type\r\n-- data WhySym (a :: j) :: forall z (y :: z). (a :~~: y) ~> Type\r\n-- The version above does NOT panic\r\ntype instance Apply (WhySym a) e = Why a e\r\n\r\nhsym :: forall (j :: Type) (k :: Type) (a :: j) (b :: k).\r\n a :~~: b -> b :~~: a\r\nhsym eq = case toSing eq of\r\n SomeSing (singEq :: Sing r) ->\r\n (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl\r\n}}}\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180627 for x86_64-unknown-linux):\r\n coercionKind\r\n Nth:3\r\n (Inst {co_a1jI} (Coh <k_a1js[sk:1]>_N (Nth:0 (Sym {co_a1jI}))))\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable\r\n pprPanic, called at compiler/types/Coercion.hs:1887:9 in ghc:Coercion\r\n}}}\r\n\r\nAs noted in the comments, replacing `WhySym` with a version that explicitly quantifies `z` avoids the panic.\r\n\r\nThis is a regression from GHC 8.4.3, in which the program simply errored:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:56:38: error:\r\n • Expected kind ‘forall z (y :: z). (a1 :~~: y) ~> *’,\r\n but ‘WhySym a’ has kind ‘forall (y :: z0).\r\n TyFun (a1 :~~: y) * -> *’\r\n • In the type ‘(WhySym a)’\r\n In the expression: (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl\r\n In a case alternative:\r\n SomeSing (singEq :: Sing r)\r\n -> (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl\r\n • Relevant bindings include\r\n singEq :: Sing a2 (bound at Bug.hs:55:23)\r\n eq :: a1 :~~: b (bound at Bug.hs:54:6)\r\n hsym :: (a1 :~~: b) -> b :~~: a1 (bound at Bug.hs:54:1)\r\n |\r\n56 | (~>:~~:) @j @k @a @b @(WhySym a) @r singEq HRefl\r\n | ^^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15346Core Lint error in GHC 8.6.1: From-type of Cast differs from type of enclosed...2019-07-07T18:13:04ZRyan ScottCore Lint error in GHC 8.6.1: From-type of Cast differs from type of enclosed expressionThe following program typechecks on GHC 8.6.1-alpha1:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedT...The following program typechecks on GHC 8.6.1-alpha1:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module SGenerics where
import Data.Kind
import Data.Type.Equality
import Data.Void
-----
-- singletons machinery
-----
data family Sing :: forall k. k -> Type
data instance Sing :: () -> Type where
STuple0 :: Sing '()
type Refuted a = a -> Void
data Decision a = Proved a | Disproved (Refuted a)
-----
-- A stripped down version of GHC.Generics
-----
data U1 = MkU1
data instance Sing (z :: U1) where
SMkU1 :: Sing MkU1
-----
class Generic (a :: Type) where
type Rep a :: Type
from :: a -> Rep a
to :: Rep a -> a
class PGeneric (a :: Type) where
type PFrom (x :: a) :: Rep a
type PTo (x :: Rep a) :: a
class SGeneric k where
sFrom :: forall (a :: k). Sing a -> Sing (PFrom a)
sTo :: forall (a :: Rep k). Sing a -> Sing (PTo a :: k)
sTof :: forall (a :: k). Sing a -> PTo (PFrom a) :~: a
sFot :: forall (a :: Rep k). Sing a -> PFrom (PTo a :: k) :~: a
-----
instance Generic () where
type Rep () = U1
from () = MkU1
to MkU1 = ()
instance PGeneric () where
type PFrom '() = MkU1
type PTo 'MkU1 = '()
instance SGeneric () where
sFrom STuple0 = SMkU1
sTo SMkU1 = STuple0
sTof STuple0 = Refl
sFot SMkU1 = Refl
-----
class SDecide k where
-- | Compute a proof or disproof of equality, given two singletons.
(%~) :: forall (a :: k) (b :: k). Sing a -> Sing b -> Decision (a :~: b)
default (%~) :: forall (a :: k) (b :: k). (SGeneric k, SDecide (Rep k))
=> Sing a -> Sing b -> Decision (a :~: b)
s1 %~ s2 = case sFrom s1 %~ sFrom s2 of
Proved (Refl :: PFrom a :~: PFrom b) ->
let r :: PTo (PFrom a) :~: PTo (PFrom b)
r = Refl
sTof1 :: PTo (PFrom a) :~: a
sTof1 = sTof s1
sTof2 :: PTo (PFrom b) :~: b
sTof2 = sTof s2
in Proved (sym sTof1 `trans` r `trans` sTof2)
Disproved contra -> Disproved (\Refl -> contra Refl)
instance SDecide U1 where
SMkU1 %~ SMkU1 = Proved Refl
instance SDecide ()
```
However, it throws a Core Lint error with `-dcore-lint`. The full error is absolutely massive, so I'll attach it separately. Here is the top-level bit:
```
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
In the expression: <elided>
From-type of Cast differs from type of enclosed expression
From-type: U1
Type of enclosed expr: Rep ()
Actual enclosed expr: PFrom a_a1Fm
Coercion used in cast: Sym (D:R:Rep()[0])
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| 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":"Core Lint error in GHC 8.6.1: From-type of Cast differs from type of enclosed expression","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program typechecks on GHC 8.6.1-alpha1:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE DefaultSignatures #-}\r\n{-# LANGUAGE EmptyCase #-}\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule SGenerics where\r\n\r\nimport Data.Kind\r\nimport Data.Type.Equality\r\nimport Data.Void\r\n\r\n-----\r\n-- singletons machinery\r\n-----\r\n\r\ndata family Sing :: forall k. k -> Type\r\n\r\ndata instance Sing :: () -> Type where\r\n STuple0 :: Sing '()\r\n\r\ntype Refuted a = a -> Void\r\ndata Decision a = Proved a | Disproved (Refuted a)\r\n\r\n-----\r\n-- A stripped down version of GHC.Generics\r\n-----\r\n\r\ndata U1 = MkU1\r\ndata instance Sing (z :: U1) where\r\n SMkU1 :: Sing MkU1\r\n\r\n-----\r\n\r\nclass Generic (a :: Type) where\r\n type Rep a :: Type\r\n from :: a -> Rep a\r\n to :: Rep a -> a\r\n\r\nclass PGeneric (a :: Type) where\r\n type PFrom (x :: a) :: Rep a\r\n type PTo (x :: Rep a) :: a\r\n\r\nclass SGeneric k where\r\n sFrom :: forall (a :: k). Sing a -> Sing (PFrom a)\r\n sTo :: forall (a :: Rep k). Sing a -> Sing (PTo a :: k)\r\n sTof :: forall (a :: k). Sing a -> PTo (PFrom a) :~: a\r\n sFot :: forall (a :: Rep k). Sing a -> PFrom (PTo a :: k) :~: a\r\n\r\n-----\r\n\r\ninstance Generic () where\r\n type Rep () = U1\r\n from () = MkU1\r\n to MkU1 = ()\r\n\r\ninstance PGeneric () where\r\n type PFrom '() = MkU1\r\n type PTo 'MkU1 = '()\r\n\r\ninstance SGeneric () where\r\n sFrom STuple0 = SMkU1\r\n sTo SMkU1 = STuple0\r\n sTof STuple0 = Refl\r\n sFot SMkU1 = Refl\r\n\r\n-----\r\n\r\nclass SDecide k where\r\n -- | Compute a proof or disproof of equality, given two singletons.\r\n (%~) :: forall (a :: k) (b :: k). Sing a -> Sing b -> Decision (a :~: b)\r\n default (%~) :: forall (a :: k) (b :: k). (SGeneric k, SDecide (Rep k))\r\n => Sing a -> Sing b -> Decision (a :~: b)\r\n s1 %~ s2 = case sFrom s1 %~ sFrom s2 of\r\n Proved (Refl :: PFrom a :~: PFrom b) ->\r\n let r :: PTo (PFrom a) :~: PTo (PFrom b)\r\n r = Refl\r\n\r\n sTof1 :: PTo (PFrom a) :~: a\r\n sTof1 = sTof s1\r\n\r\n sTof2 :: PTo (PFrom b) :~: b\r\n sTof2 = sTof s2\r\n in Proved (sym sTof1 `trans` r `trans` sTof2)\r\n Disproved contra -> Disproved (\\Refl -> contra Refl)\r\n\r\ninstance SDecide U1 where\r\n SMkU1 %~ SMkU1 = Proved Refl\r\n\r\ninstance SDecide ()\r\n}}}\r\n\r\nHowever, it throws a Core Lint error with `-dcore-lint`. The full error is absolutely massive, so I'll attach it separately. Here is the top-level bit:\r\n\r\n{{{\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n In the expression: <elided>\r\n From-type of Cast differs from type of enclosed expression\r\n From-type: U1\r\n Type of enclosed expr: Rep ()\r\n Actual enclosed expr: PFrom a_a1Fm\r\n Coercion used in cast: Sym (D:R:Rep()[0])\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15368Type families, holes and -fdefer-type-errors may cause 'opt_univ fell into a ...2019-07-07T18:12:57ZdramforeverType families, holes and -fdefer-type-errors may cause 'opt_univ fell into a hole' panicThis program, when compiled like `ghc -fdefer-type-errors -c panic.hs`:
```hs
{-# LANGUAGE TypeFamilies #-}
module MorePanic where
transitive :: (a, b) -> (b, c) -> (a, c)
transitive = undefined
trigger :: a -> b -> (F a b, F b a)
tr...This program, when compiled like `ghc -fdefer-type-errors -c panic.hs`:
```hs
{-# LANGUAGE TypeFamilies #-}
module MorePanic where
transitive :: (a, b) -> (b, c) -> (a, c)
transitive = undefined
trigger :: a -> b -> (F a b, F b a)
trigger _ _ = _ `transitive` trigger _ _
type family F (n :: *) (m :: *) :: *
```
Gives this panic after several error messages:
```
ghc.EXE: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-mingw32):
opt_univ fell into a hole
{co_a7Sj}
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler\\types\\OptCoercion.hs:242:5 in ghc:OptCoercion
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
This bug also affects GHCi. Attached is full output
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Type families, holes and -fdefer-type-errors may cause 'opt_univ fell into a hole' panic","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\nThis program, when compiled like `ghc -fdefer-type-errors -c panic.hs`:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE TypeFamilies #-}\r\n\r\nmodule MorePanic where\r\n\r\ntransitive :: (a, b) -> (b, c) -> (a, c)\r\ntransitive = undefined\r\n\r\ntrigger :: a -> b -> (F a b, F b a)\r\ntrigger _ _ = _ `transitive` trigger _ _\r\n\r\ntype family F (n :: *) (m :: *) :: *\r\n}}}\r\n\r\nGives this panic after several error messages:\r\n\r\n{{{\r\nghc.EXE: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-mingw32):\r\n\topt_univ fell into a hole\r\n {co_a7Sj}\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\\\\types\\\\OptCoercion.hs:242:5 in ghc:OptCoercion\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThis bug also affects GHCi. Attached is full output","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15370Typed hole panic on GHC 8.6 (tcTyVarDetails)2019-07-07T18:12:57ZRyan ScottTyped hole panic on GHC 8.6 (tcTyVarDetails)The following program panics on GHC 8.6 and HEAD:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperat...The following program panics on GHC 8.6 and HEAD:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
import Data.Type.Equality
import Data.Void
data family Sing :: forall k. k -> Type
data (~>) :: Type -> Type -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
newtype instance Sing (f :: k1 ~> k2) =
SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }
mkRefl :: n :~: j
mkRefl = Refl
right :: forall (r :: (x :~: y) ~> z).
Sing r -> ()
right no =
case mkRefl @x @y of
Refl -> applySing no _
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180627 for x86_64-unknown-linux):
tcTyVarDetails
co_a1BG :: y_a1Bz[sk:1] ~# x_a1By[sk:1]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable
pprPanic, called at compiler/basicTypes/Var.hs:497:22 in ghc:Var
```
On GHC 8.4, this simply errors:
```
$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:23:10: error:
• Couldn't match type ‘n’ with ‘j’
‘n’ is a rigid type variable bound by
the type signature for:
mkRefl :: forall k1 (n :: k1) (j :: k1). n :~: j
at Bug.hs:22:1-17
‘j’ is a rigid type variable bound by
the type signature for:
mkRefl :: forall k1 (n :: k1) (j :: k1). n :~: j
at Bug.hs:22:1-17
Expected type: n :~: j
Actual type: n :~: n
• In the expression: Refl
In an equation for ‘mkRefl’: mkRefl = Refl
• Relevant bindings include
mkRefl :: n :~: j (bound at Bug.hs:23:1)
|
23 | mkRefl = Refl
| ^^^^
Bug.hs:29:13: error:
• Couldn't match type ‘Sing (Apply r t0)’ with ‘()’
Expected type: ()
Actual type: Sing (Apply r t0)
• In the expression: applySing no _
In a case alternative: Refl -> applySing no _
In the expression: case mkRefl @x @y of { Refl -> applySing no _ }
• Relevant bindings include
no :: Sing r (bound at Bug.hs:27:7)
right :: Sing r -> () (bound at Bug.hs:27:1)
|
29 | Refl -> applySing no _
| ^^^^^^^^^^^^^^
Bug.hs:29:26: error:
• Found hole: _ :: Sing t0
Where: ‘t0’ is an ambiguous type variable
‘y’, ‘x’, ‘k’ are rigid type variables bound by
the type signature for:
right :: forall k1 (x1 :: k1) (y1 :: k1) z (r :: (x1 :~: y1) ~> z).
Sing r -> ()
at Bug.hs:(25,1)-(26,21)
• In the second argument of ‘applySing’, namely ‘_’
In the expression: applySing no _
In a case alternative: Refl -> applySing no _
• Relevant bindings include
no :: Sing r (bound at Bug.hs:27:7)
right :: Sing r -> () (bound at Bug.hs:27:1)
Valid substitutions include
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ at Bug.hs:7:8-10
(and originally defined in ‘GHC.Err’))
|
29 | Refl -> applySing no _
| ^
```
Note that this is distinct from #15142, as this is still reproducible on HEAD, even after commit 030211d21207dabb7a4bf21cc9af6fa5eb066db1.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.3 |
| 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":"Typed hole panic on GHC 8.6 (tcTyVarDetails)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["TypeInType,","TypedHoles"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics on GHC 8.6 and HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Type.Equality\r\nimport Data.Void\r\n\r\ndata family Sing :: forall k. k -> Type\r\n\r\ndata (~>) :: Type -> Type -> Type\r\ninfixr 0 ~>\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\n\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }\r\n\r\nmkRefl :: n :~: j\r\nmkRefl = Refl\r\n\r\nright :: forall (r :: (x :~: y) ~> z).\r\n Sing r -> ()\r\nright no =\r\n case mkRefl @x @y of\r\n Refl -> applySing no _\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180627 for x86_64-unknown-linux):\r\n tcTyVarDetails\r\n co_a1BG :: y_a1Bz[sk:1] ~# x_a1By[sk:1]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable\r\n pprPanic, called at compiler/basicTypes/Var.hs:497:22 in ghc:Var\r\n}}}\r\n\r\nOn GHC 8.4, this simply errors:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Bug.hs \r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:23:10: error:\r\n • Couldn't match type ‘n’ with ‘j’\r\n ‘n’ is a rigid type variable bound by\r\n the type signature for:\r\n mkRefl :: forall k1 (n :: k1) (j :: k1). n :~: j\r\n at Bug.hs:22:1-17\r\n ‘j’ is a rigid type variable bound by\r\n the type signature for:\r\n mkRefl :: forall k1 (n :: k1) (j :: k1). n :~: j\r\n at Bug.hs:22:1-17\r\n Expected type: n :~: j\r\n Actual type: n :~: n\r\n • In the expression: Refl\r\n In an equation for ‘mkRefl’: mkRefl = Refl\r\n • Relevant bindings include\r\n mkRefl :: n :~: j (bound at Bug.hs:23:1)\r\n |\r\n23 | mkRefl = Refl\r\n | ^^^^\r\n\r\nBug.hs:29:13: error:\r\n • Couldn't match type ‘Sing (Apply r t0)’ with ‘()’\r\n Expected type: ()\r\n Actual type: Sing (Apply r t0)\r\n • In the expression: applySing no _\r\n In a case alternative: Refl -> applySing no _\r\n In the expression: case mkRefl @x @y of { Refl -> applySing no _ }\r\n • Relevant bindings include\r\n no :: Sing r (bound at Bug.hs:27:7)\r\n right :: Sing r -> () (bound at Bug.hs:27:1)\r\n |\r\n29 | Refl -> applySing no _\r\n | ^^^^^^^^^^^^^^\r\n\r\nBug.hs:29:26: error:\r\n • Found hole: _ :: Sing t0\r\n Where: ‘t0’ is an ambiguous type variable\r\n ‘y’, ‘x’, ‘k’ are rigid type variables bound by\r\n the type signature for:\r\n right :: forall k1 (x1 :: k1) (y1 :: k1) z (r :: (x1 :~: y1) ~> z).\r\n Sing r -> ()\r\n at Bug.hs:(25,1)-(26,21)\r\n • In the second argument of ‘applySing’, namely ‘_’\r\n In the expression: applySing no _\r\n In a case alternative: Refl -> applySing no _\r\n • Relevant bindings include\r\n no :: Sing r (bound at Bug.hs:27:7)\r\n right :: Sing r -> () (bound at Bug.hs:27:1)\r\n Valid substitutions include\r\n undefined :: forall (a :: TYPE r).\r\n GHC.Stack.Types.HasCallStack =>\r\n a\r\n (imported from ‘Prelude’ at Bug.hs:7:8-10\r\n (and originally defined in ‘GHC.Err’))\r\n |\r\n29 | Refl -> applySing no _\r\n | ^\r\n}}}\r\n\r\nNote that this is distinct from #15142, as this is still reproducible on HEAD, even after commit 030211d21207dabb7a4bf21cc9af6fa5eb066db1.","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Matthías Páll GissurarsonMatthías Páll Gissurarsonhttps://gitlab.haskell.org/ghc/ghc/-/issues/15396-staticlib is broken on GHC 8.4.3 on Linux under certain conditions2019-07-07T18:05:17ZRyan Scott-staticlib is broken on GHC 8.4.3 on Linux under certain conditionsWhen compiling this simple program:
```hs
main = pure ()
```
Using the `-staticlib` flag on GHC 8.4.3 on Linux, it panics if using a certain toolchain:
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Descript...When compiling this simple program:
```hs
main = pure ()
```
Using the `-staticlib` flag on GHC 8.4.3 on Linux, it panics if using a certain toolchain:
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
$ /opt/ghc/8.4.3/bin/ghc -fforce-recomp -staticlib Bug.hs
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug.a ...
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
Data.Binary.Get.runGet at position 27462987: Invalid archive header end marker
CallStack (from HasCallStack):
error, called at libraries/binary/src/Data/Binary/Get.hs:351:5 in binary-0.8.5.1:Data.Binary.Get
```
I say "certain toolchain" since I am able to reproduce this issue on Ubuntu 14.04, but not 18.04:
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
$ /opt/ghc/8.4.3/bin/ghc -fforce-recomp -staticlib Bug.hs
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug.a ...
```
This issue does not occur on GHC 8.2 and earlier:
```
$ /opt/ghc/8.2.2/bin/ghc -staticlib Bug.hs
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug.a ...
Static archive creation only supported on Darwin/OS X/iOS
```
Commit b8f33bc6b738b0378976e42b79369f0e53b680c7 allowed the use of `-staticlib` on all platforms. angerman, do you know what might be happening here?8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15411urk! lookup local fingerprint2019-10-09T10:33:08Zadmockurk! lookup local fingerprintWhen building GHC 8.6.0-alpha2 the build fails with the following error.
```
[ghc-8.6.0.20180714] alan% 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_bui...When building GHC 8.6.0-alpha2 the build fails with the following error.
```
[ghc-8.6.0.20180714] alan% 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-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -H32m -O -Wall -hide-all-packages -i -iutils/haddock/driver -iutils/haddock/haddock-api/src -iutils/haddock/haddock-library/src -iutils/haddock/dist/build -Iutils/haddock/dist/build -iutils/haddock/dist/build/haddock/autogen -Iutils/haddock/dist/build/haddock/autogen -optP-DIN_GHC_TREE -optP-include -optPutils/haddock/dist/build/haddock/autogen/cabal_macros.h -package-id Cabal-2.3.0.0 -package-id array-0.5.2.0 -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id containers-0.6.0.1 -package-id deepseq-1.4.4.0 -package-id directory-1.3.3.0 -package-id filepath-1.4.2 -package-id ghc-8.6.0.20180714 -package-id ghc-boot-8.6.0.20180714 -package-id parsec-3.1.13.0.0.0.0.0 -package-id text-1.2.3.0 -package-id transformers-0.5.5.0 -package-id xhtml-3000.2.2.1 -funbox-strict-fields -Wall -fwarn-tabs -O2 -threaded -XHaskell2010 -no-user-package-db -rtsopts -Wno-unused-imports -Wno-deprecations -Wnoncanonical-monad-instances -odir utils/haddock/dist/build -hidir utils/haddock/dist/build -stubdir utils/haddock/dist/build -c utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs -o utils/haddock/dist/build/Haddock/Backends/Hyperlinker/Types.dyn_o
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180714 for powerpc64-unknown-linux):
urk! lookup local fingerprint
$fEqTokenDetails
[cESf79 :-> (Span, 3bafa1c9fb27c5bcc8d6a0fca267f340)]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable
pprPanic, called at compiler/iface/MkIface.hs:523:37 in ghc:MkIface
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
make[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Haddock/Backends/Hyperlinker/Types.dyn_o] Error 1
make: *** [Makefile:127: all] Error 2
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"urk! lookup local fingerprint","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"When building GHC 8.6.0-alpha2 the build fails with the following error.\r\n\r\n{{{\r\n[ghc-8.6.0.20180714] alan% make\r\n===--- building phase 0\r\nmake --no-print-directory -f ghc.mk phase=0 phase_0_builds\r\nmake[1]: Nothing to be done for 'phase_0_builds'.\r\n===--- building phase 1\r\nmake --no-print-directory -f ghc.mk phase=1 phase_1_builds\r\nmake[1]: Nothing to be done for 'phase_1_builds'.\r\n===--- building final phase\r\nmake --no-print-directory -f ghc.mk phase=final all\r\n\"inplace/bin/ghc-stage2\" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -H32m -O -Wall -hide-all-packages -i -iutils/haddock/driver -iutils/haddock/haddock-api/src -iutils/haddock/haddock-library/src -iutils/haddock/dist/build -Iutils/haddock/dist/build -iutils/haddock/dist/build/haddock/autogen -Iutils/haddock/dist/build/haddock/autogen -optP-DIN_GHC_TREE -optP-include -optPutils/haddock/dist/build/haddock/autogen/cabal_macros.h -package-id Cabal-2.3.0.0 -package-id array-0.5.2.0 -package-id base-4.12.0.0 -package-id bytestring-0.10.8.2 -package-id containers-0.6.0.1 -package-id deepseq-1.4.4.0 -package-id directory-1.3.3.0 -package-id filepath-1.4.2 -package-id ghc-8.6.0.20180714 -package-id ghc-boot-8.6.0.20180714 -package-id parsec-3.1.13.0.0.0.0.0 -package-id text-1.2.3.0 -package-id transformers-0.5.5.0 -package-id xhtml-3000.2.2.1 -funbox-strict-fields -Wall -fwarn-tabs -O2 -threaded -XHaskell2010 -no-user-package-db -rtsopts -Wno-unused-imports -Wno-deprecations -Wnoncanonical-monad-instances -odir utils/haddock/dist/build -hidir utils/haddock/dist/build -stubdir utils/haddock/dist/build -c utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs -o utils/haddock/dist/build/Haddock/Backends/Hyperlinker/Types.dyn_o\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180714 for powerpc64-unknown-linux):\r\n urk! lookup local fingerprint\r\n $fEqTokenDetails\r\n [cESf79 :-> (Span, 3bafa1c9fb27c5bcc8d6a0fca267f340)]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable\r\n pprPanic, called at compiler/iface/MkIface.hs:523:37 in ghc:MkIface\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\nmake[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Haddock/Backends/Hyperlinker/Types.dyn_o] Error 1\r\nmake: *** [Makefile:127: all] Error 2\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1Peter Trommlerptrommler@acm.orgPeter Trommlerptrommler@acm.orghttps://gitlab.haskell.org/ghc/ghc/-/issues/15419GHC 8.6.1 regression (buildKindCoercion)2019-07-07T18:04:59ZRyan ScottGHC 8.6.1 regression (buildKindCoercion)The following program typechecks on GHC 8.4.1, but panics on GHC 8.6.1 and HEAD:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes ...The following program typechecks on GHC 8.4.1, but panics on GHC 8.6.1 and HEAD:
```hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Kind
data family Sing :: forall k. k -> Type
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
data instance Sing :: forall a b. (a, b) -> Type where
STuple2 :: Sing x -> Sing y -> Sing '(x, y)
newtype instance Sing (f :: k1 ~> k2) =
SLambda { applySing :: forall t. Sing t -> Sing (f `Apply` t) }
-----
newtype Par1 p = Par1 p
newtype K1 c p = K1 c
data (f :*: g) p = f p :*: g p
data instance Sing :: forall p. Par1 p -> Type where
SPar1 :: Sing x -> Sing ('Par1 x)
data instance Sing :: forall k c (p :: k). K1 c p -> Type where
SK1 :: Sing x -> Sing ('K1 x)
data instance Sing :: forall k (f :: k -> Type) (g :: k -> Type) (p :: k).
(f :*: g) p -> Type where
(:%*:) :: Sing x -> Sing y -> Sing (x ':*: y)
class Generic1 (f :: k -> Type) where
type Rep1 f :: k -> Type
from1 :: f a -> Rep1 f a
to1 :: Rep1 f a -> f a
class PGeneric1 (f :: k -> Type) where
type From1 (z :: f a) :: Rep1 f a
type To1 (z :: Rep1 f a) :: f a
class SGeneric1 (f :: k -> Type) where
sFrom1 :: forall (a :: k) (z :: f a). Sing z -> Sing (From1 z)
sTo1 :: forall (a :: k) (r :: Rep1 f a). Sing r -> Sing (To1 r :: f a)
instance Generic1 ((,) a) where
type Rep1 ((,) a) = K1 a :*: Par1
from1 (x, y) = K1 x :*: Par1 y
to1 (K1 x :*: Par1 y) = (x, y)
instance PGeneric1 ((,) a) where
type From1 '(x, y) = 'K1 x ':*: 'Par1 y
type To1 ('K1 x ':*: 'Par1 y) = '(x, y)
instance SGeneric1 ((,) a) where
sFrom1 (STuple2 x y) = SK1 x :%*: SPar1 y
sTo1 (SK1 x :%*: SPar1 y) = STuple2 x y
-----
type family GenericFmap (g :: a ~> b) (x :: f a) :: f b where
GenericFmap g x = To1 (Fmap g (From1 x))
class PFunctor (f :: Type -> Type) where
type Fmap (g :: a ~> b) (x :: f a) :: f b
type Fmap g x = GenericFmap g x
class SFunctor (f :: Type -> Type) where
sFmap :: forall a b (g :: a ~> b) (x :: f a).
Sing g -> Sing x -> Sing (Fmap g x)
default sFmap :: forall a b (g :: a ~> b) (x :: f a).
( SGeneric1 f, SFunctor (Rep1 f)
, Fmap g x ~ GenericFmap g x )
=> Sing g -> Sing x -> Sing (Fmap g x)
sFmap sg sx = sTo1 (sFmap sg (sFrom1 sx))
-----
instance PFunctor Par1 where
type Fmap f ('Par1 x) = 'Par1 (f `Apply` x)
instance PFunctor (K1 c) where
type Fmap _ ('K1 x) = 'K1 x
instance PFunctor (f :*: g) where
type Fmap h (x ':*: y) = Fmap h x ':*: Fmap h y
instance SFunctor Par1 where
sFmap sf (SPar1 sx) = SPar1 (sf `applySing` sx)
instance SFunctor (K1 c) where
sFmap _ (SK1 sx) = SK1 sx
instance (SFunctor f, SFunctor g) => SFunctor (f :*: g) where
sFmap sh (sx :%*: sy) = sFmap sh sx :%*: sFmap sh sy
-----
instance PFunctor ((,) a)
-- The line below causes the panic
instance SFunctor ((,) a)
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180714 for x86_64-unknown-linux):
buildKindCoercion
K1 a_a1Nj :*: Par1
Rep1 ((,) a_a1Nj)
*
a_a1Nj
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable
pprPanic, called at compiler/types/Coercion.hs:2069:9 in ghc:Coercion
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC 8.6.1 regression (buildKindCoercion)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program typechecks on GHC 8.4.1, but panics on GHC 8.6.1 and HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ConstraintKinds #-}\r\n{-# LANGUAGE DefaultSignatures #-}\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ndata family Sing :: forall k. k -> Type\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\n\r\ndata instance Sing :: forall a b. (a, b) -> Type where\r\n STuple2 :: Sing x -> Sing y -> Sing '(x, y)\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { applySing :: forall t. Sing t -> Sing (f `Apply` t) }\r\n\r\n-----\r\n\r\nnewtype Par1 p = Par1 p\r\nnewtype K1 c p = K1 c\r\ndata (f :*: g) p = f p :*: g p\r\n\r\ndata instance Sing :: forall p. Par1 p -> Type where\r\n SPar1 :: Sing x -> Sing ('Par1 x)\r\ndata instance Sing :: forall k c (p :: k). K1 c p -> Type where\r\n SK1 :: Sing x -> Sing ('K1 x)\r\ndata instance Sing :: forall k (f :: k -> Type) (g :: k -> Type) (p :: k).\r\n (f :*: g) p -> Type where\r\n (:%*:) :: Sing x -> Sing y -> Sing (x ':*: y)\r\n\r\nclass Generic1 (f :: k -> Type) where\r\n type Rep1 f :: k -> Type\r\n from1 :: f a -> Rep1 f a\r\n to1 :: Rep1 f a -> f a\r\n\r\nclass PGeneric1 (f :: k -> Type) where\r\n type From1 (z :: f a) :: Rep1 f a\r\n type To1 (z :: Rep1 f a) :: f a\r\n\r\nclass SGeneric1 (f :: k -> Type) where\r\n sFrom1 :: forall (a :: k) (z :: f a). Sing z -> Sing (From1 z)\r\n sTo1 :: forall (a :: k) (r :: Rep1 f a). Sing r -> Sing (To1 r :: f a)\r\n\r\ninstance Generic1 ((,) a) where\r\n type Rep1 ((,) a) = K1 a :*: Par1\r\n from1 (x, y) = K1 x :*: Par1 y\r\n to1 (K1 x :*: Par1 y) = (x, y)\r\n\r\ninstance PGeneric1 ((,) a) where\r\n type From1 '(x, y) = 'K1 x ':*: 'Par1 y\r\n type To1 ('K1 x ':*: 'Par1 y) = '(x, y)\r\n\r\ninstance SGeneric1 ((,) a) where\r\n sFrom1 (STuple2 x y) = SK1 x :%*: SPar1 y\r\n sTo1 (SK1 x :%*: SPar1 y) = STuple2 x y\r\n\r\n-----\r\n\r\ntype family GenericFmap (g :: a ~> b) (x :: f a) :: f b where\r\n GenericFmap g x = To1 (Fmap g (From1 x))\r\n\r\nclass PFunctor (f :: Type -> Type) where\r\n type Fmap (g :: a ~> b) (x :: f a) :: f b\r\n type Fmap g x = GenericFmap g x\r\n\r\nclass SFunctor (f :: Type -> Type) where\r\n sFmap :: forall a b (g :: a ~> b) (x :: f a).\r\n Sing g -> Sing x -> Sing (Fmap g x)\r\n default sFmap :: forall a b (g :: a ~> b) (x :: f a).\r\n ( SGeneric1 f, SFunctor (Rep1 f)\r\n , Fmap g x ~ GenericFmap g x )\r\n => Sing g -> Sing x -> Sing (Fmap g x)\r\n sFmap sg sx = sTo1 (sFmap sg (sFrom1 sx))\r\n\r\n-----\r\n\r\ninstance PFunctor Par1 where\r\n type Fmap f ('Par1 x) = 'Par1 (f `Apply` x)\r\ninstance PFunctor (K1 c) where\r\n type Fmap _ ('K1 x) = 'K1 x\r\ninstance PFunctor (f :*: g) where\r\n type Fmap h (x ':*: y) = Fmap h x ':*: Fmap h y\r\n\r\ninstance SFunctor Par1 where\r\n sFmap sf (SPar1 sx) = SPar1 (sf `applySing` sx)\r\ninstance SFunctor (K1 c) where\r\n sFmap _ (SK1 sx) = SK1 sx\r\ninstance (SFunctor f, SFunctor g) => SFunctor (f :*: g) where\r\n sFmap sh (sx :%*: sy) = sFmap sh sx :%*: sFmap sh sy\r\n\r\n-----\r\n\r\ninstance PFunctor ((,) a)\r\n-- The line below causes the panic\r\ninstance SFunctor ((,) a)\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180714 for x86_64-unknown-linux):\r\n buildKindCoercion\r\n K1 a_a1Nj :*: Par1\r\n Rep1 ((,) a_a1Nj)\r\n *\r\n a_a1Nj\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable\r\n pprPanic, called at compiler/types/Coercion.hs:2069:9 in ghc:Coercion\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1Richard Eisenbergrae@richarde.devRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/15428Oversaturated type family application panicks GHC (piResultTys2)2019-07-07T18:04:56ZRyan ScottOversaturated type family application panicks GHC (piResultTys2)The following program panics when compiled with GHC 8.6.1 or HEAD:
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
im...The following program panics when compiled with GHC 8.6.1 or HEAD:
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
import Data.Proxy
import Data.Type.Equality
type family Flurmp :: k
type family Pure (x :: a) :: f a
wat :: forall (f :: Type -> Type) (p :: Type).
Proxy (f p) -> ()
wat _ =
let s :: (Flurmp :: f p)
:~: Pure (Flurmp :: p -> p) (Flurmp :: p)
s = undefined
in ()
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180714 for x86_64-unknown-linux):
piResultTys2
f_aAT a_aAU
[(->) p_a1uI[sk:1], p_a1uI[sk:1] -> p_a1uI[sk:1], Flurmp, Flurmp]
[Flurmp]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1041:9 in ghc:Type
```
On GHC 8.4 and earlier, this simply gives an error message:
```
$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:18:16: error:
• Expecting one more argument to ‘Pure (Flurmp :: p -> p)’
Expected kind ‘p -> f p’,
but ‘Pure (Flurmp :: p -> p)’ has kind ‘p -> p -> p’
• In the second argument of ‘(:~:)’, namely
‘Pure (Flurmp :: p -> p) (Flurmp :: p)’
In the type signature:
s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p)
In the expression:
let
s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p)
s = undefined
in ()
• Relevant bindings include
wat :: Proxy (f p) -> () (bound at Bug.hs:16:1)
|
18 | :~: Pure (Flurmp :: p -> p) (Flurmp :: p)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.5 |
| 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":"GHC 8.6+ panics (piResultTys2), older GHCs don't","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":["TypeFamilies","TypeInType,"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics when compiled with GHC 8.6.1 or HEAD:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Proxy\r\nimport Data.Type.Equality\r\n\r\ntype family Flurmp :: k\r\ntype family Pure (x :: a) :: f a\r\n\r\nwat :: forall (f :: Type -> Type) (p :: Type).\r\n Proxy (f p) -> ()\r\nwat _ =\r\n let s :: (Flurmp :: f p)\r\n :~: Pure (Flurmp :: p -> p) (Flurmp :: p)\r\n s = undefined\r\n in ()\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180714 for x86_64-unknown-linux):\r\n piResultTys2\r\n f_aAT a_aAU\r\n [(->) p_a1uI[sk:1], p_a1uI[sk:1] -> p_a1uI[sk:1], Flurmp, Flurmp]\r\n [Flurmp]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in ghc:Outputable\r\n pprPanic, called at compiler/types/Type.hs:1041:9 in ghc:Type\r\n}}}\r\n\r\nOn GHC 8.4 and earlier, this simply gives an error message:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:18:16: error:\r\n • Expecting one more argument to ‘Pure (Flurmp :: p -> p)’\r\n Expected kind ‘p -> f p’,\r\n but ‘Pure (Flurmp :: p -> p)’ has kind ‘p -> p -> p’\r\n • In the second argument of ‘(:~:)’, namely\r\n ‘Pure (Flurmp :: p -> p) (Flurmp :: p)’\r\n In the type signature:\r\n s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p)\r\n In the expression:\r\n let\r\n s :: (Flurmp :: f p) :~: Pure (Flurmp :: p -> p) (Flurmp :: p)\r\n s = undefined\r\n in ()\r\n • Relevant bindings include\r\n wat :: Proxy (f p) -> () (bound at Bug.hs:16:1)\r\n |\r\n18 | :~: Pure (Flurmp :: p -> p) (Flurmp :: p)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15436Compile-time panic, Prelude.!!: negative index2019-07-07T18:04:54ZpbrisbinCompile-time panic, Prelude.!!: negative indexHere is a reproduction case:
- \*ghc-repro.cabal\*\*
```
name: ghc-repro
version: 0.0.0
build-type: Simple
cabal-version: >= 1.10
library
exposed-modules:
Lib
other-modules:
Paths_ghc_repro
hs-s...Here is a reproduction case:
- \*ghc-repro.cabal\*\*
```
name: ghc-repro
version: 0.0.0
build-type: Simple
cabal-version: >= 1.10
library
exposed-modules:
Lib
other-modules:
Paths_ghc_repro
hs-source-dirs:
src
build-depends:
base
default-language: Haskell2010
```
- \*src/Lib.hs\*\*
```hs
{-# OPTIONS_GHC -v4 #-}
module Lib where
import GHC.Enum
-- | At this many elements, it panics. One fewer, it works
data USState = AL | AK | AZ | AR | CA | CO | CT | DE | FL -- | GA
-- | HI | ID | IL | IN | IA | KS | KY | LA | ME | MD
-- | MA | MI | MN | MS | MO | MT | NE | NV | NH | NJ
-- | NM | NY | NC | ND | OH | OK | OR | PA | RI | SC
-- | SD | TN | TX | UT | VT | VA | WA | WV | WI | WY
-- | DC | PR | VI | AS | GU | MP | AA | AE | AP
deriving (Eq, Show, Ord, Bounded, Read, Enum)
data USStateOrIntl = International | US USState
instance Enum USStateOrIntl where
fromEnum International = 0
fromEnum (US s) = 1 + fromEnum s
enumFrom = boundedEnumFrom
enumFromThen = boundedEnumFromThen
toEnum 0 = International
toEnum i = US . toEnum $ i - 1
instance Bounded USStateOrIntl where
minBound = International
maxBound = US maxBound
```
- \*Results\*\*:
```
ghc-repro-0.0.0: build (lib)
Preprocessing library for ghc-repro-0.0.0..
Building library for ghc-repro-0.0.0..
Running phase HsPp HsSrcFile
compile: input file src/Lib.hs
*** Checking old interface for ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib (use -ddump-hi-diffs for more details):
[1 of 2] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Lib.o )
*** Parser [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
!!! Parser [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 8.31 milliseconds, allocated 17.533 megabytes
*** Renamer/typechecker [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
!!! Renamer/typechecker [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 354.49 milliseconds, allocated 312.556 megabytes
*** Desugar [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
Result size of Desugar (after optimization)
= {terms: 752, types: 352, coercions: 33, joins: 1/4}
!!! Desugar [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 142.79 milliseconds, allocated 226.278 megabytes
*** Simplifier [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
Result size of Simplifier iteration=1
= {terms: 1,222, types: 790, coercions: 143, joins: 1/3}
Result size of Simplifier iteration=2
= {terms: 1,219, types: 788, coercions: 126, joins: 0/1}
Result size of Simplifier
= {terms: 1,217, types: 786, coercions: 123, joins: 0/1}
!!! Simplifier [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 374.08 milliseconds, allocated 587.256 megabytes
*** Specialise [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
Result size of Specialise
= {terms: 1,217, types: 786, coercions: 123, joins: 0/1}
!!! Specialise [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 154.05 milliseconds, allocated 235.323 megabytes
*** Float out(FOS {Lam = Just 0,
Consts = True,
OverSatApps = False}) [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
Result size of Float out(FOS {Lam = Just 0,
Consts = True,
OverSatApps = False})
= {terms: 1,551, types: 1,410, coercions: 123, joins: 0/0}
!!! Float out(FOS {Lam = Just 0,
Consts = True,
OverSatApps = False}) [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 6.24 milliseconds, allocated 5.556 megabytes
*** Simplifier [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:
Result size of Simplifier iteration=1
= {terms: 1,667, types: 1,082, coercions: 123, joins: 7/19}
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
Prelude.!!: negative index
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
The above output was produced through my normal tooling, so
```
stack build --resolver lts-12.2 --pedantic
```
To rule out stack, I was also able to reproduce the panic with plain cabal using this \*\*Dockerfile\*\*:
```
FROM haskell:8.4.3
RUN mkdir /src
WORKDIR /src
COPY ghc-repro.cabal /src/ghc-repo.cabal
COPY src/Lib.hs /src/src/Lib.hs
RUN cabal build
```
```
docker build --tag ghc-repro .
```
It still panics, but the output is different and much larger so I'll leave it here: https://8n1.org/13499/5c92
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Compile-time panic, Prelude.!!: negative index","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Here is a reproduction case:\r\n\r\n**ghc-repro.cabal**\r\n\r\n{{{\r\nname: ghc-repro\r\nversion: 0.0.0\r\nbuild-type: Simple\r\ncabal-version: >= 1.10\r\n\r\nlibrary\r\n exposed-modules:\r\n Lib\r\n other-modules:\r\n Paths_ghc_repro\r\n hs-source-dirs:\r\n src\r\n build-depends:\r\n base\r\n default-language: Haskell2010\r\n}}}\r\n\r\n**src/Lib.hs**\r\n\r\n{{{#!hs\r\n{-# OPTIONS_GHC -v4 #-}\r\nmodule Lib where\r\n\r\nimport GHC.Enum\r\n\r\n-- | At this many elements, it panics. One fewer, it works\r\ndata USState = AL | AK | AZ | AR | CA | CO | CT | DE | FL -- | GA\r\n -- | HI | ID | IL | IN | IA | KS | KY | LA | ME | MD\r\n -- | MA | MI | MN | MS | MO | MT | NE | NV | NH | NJ\r\n -- | NM | NY | NC | ND | OH | OK | OR | PA | RI | SC\r\n -- | SD | TN | TX | UT | VT | VA | WA | WV | WI | WY\r\n -- | DC | PR | VI | AS | GU | MP | AA | AE | AP\r\n deriving (Eq, Show, Ord, Bounded, Read, Enum)\r\n\r\ndata USStateOrIntl = International | US USState\r\n\r\ninstance Enum USStateOrIntl where\r\n fromEnum International = 0\r\n fromEnum (US s) = 1 + fromEnum s\r\n enumFrom = boundedEnumFrom\r\n enumFromThen = boundedEnumFromThen\r\n toEnum 0 = International\r\n toEnum i = US . toEnum $ i - 1\r\n\r\ninstance Bounded USStateOrIntl where\r\n minBound = International\r\n maxBound = US maxBound\r\n}}}\r\n\r\n\r\n**Results**:\r\n\r\n{{{\r\nghc-repro-0.0.0: build (lib)\r\nPreprocessing library for ghc-repro-0.0.0..\r\nBuilding library for ghc-repro-0.0.0..\r\nRunning phase HsPp HsSrcFile\r\ncompile: input file src/Lib.hs\r\n*** Checking old interface for ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib (use -ddump-hi-diffs for more details):\r\n[1 of 2] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/Lib.o )\r\n*** Parser [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\n!!! Parser [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 8.31 milliseconds, allocated 17.533 megabytes\r\n*** Renamer/typechecker [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\n!!! Renamer/typechecker [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 354.49 milliseconds, allocated 312.556 megabytes\r\n*** Desugar [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\nResult size of Desugar (after optimization)\r\n = {terms: 752, types: 352, coercions: 33, joins: 1/4}\r\n!!! Desugar [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 142.79 milliseconds, allocated 226.278 megabytes\r\n*** Simplifier [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\nResult size of Simplifier iteration=1\r\n = {terms: 1,222, types: 790, coercions: 143, joins: 1/3}\r\nResult size of Simplifier iteration=2\r\n = {terms: 1,219, types: 788, coercions: 126, joins: 0/1}\r\nResult size of Simplifier\r\n = {terms: 1,217, types: 786, coercions: 123, joins: 0/1}\r\n!!! Simplifier [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 374.08 milliseconds, allocated 587.256 megabytes\r\n*** Specialise [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\nResult size of Specialise\r\n = {terms: 1,217, types: 786, coercions: 123, joins: 0/1}\r\n!!! Specialise [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 154.05 milliseconds, allocated 235.323 megabytes\r\n*** Float out(FOS {Lam = Just 0,\r\n Consts = True,\r\n OverSatApps = False}) [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\nResult size of Float out(FOS {Lam = Just 0,\r\n Consts = True,\r\n OverSatApps = False})\r\n = {terms: 1,551, types: 1,410, coercions: 123, joins: 0/0}\r\n!!! Float out(FOS {Lam = Just 0,\r\n Consts = True,\r\n OverSatApps = False}) [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]: finished in 6.24 milliseconds, allocated 5.556 megabytes\r\n*** Simplifier [ghc-repro-0.0.0-K1NxTAQg5MjG2d3fZc1tOj:Lib]:\r\nResult size of Simplifier iteration=1\r\n = {terms: 1,667, types: 1,082, coercions: 123, joins: 7/19}\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n\tPrelude.!!: negative index\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nThe above output was produced through my normal tooling, so\r\n\r\n{{{\r\nstack build --resolver lts-12.2 --pedantic\r\n}}}\r\n\r\nTo rule out stack, I was also able to reproduce the panic with plain cabal using this **Dockerfile**:\r\n\r\n{{{\r\nFROM haskell:8.4.3\r\nRUN mkdir /src\r\nWORKDIR /src\r\nCOPY ghc-repro.cabal /src/ghc-repo.cabal\r\nCOPY src/Lib.hs /src/src/Lib.hs\r\nRUN cabal build\r\n}}}\r\n\r\n{{{\r\ndocker build --tag ghc-repro .\r\n}}}\r\n\r\nIt still panics, but the output is different and much larger so I'll leave it here: https://8n1.org/13499/5c92","type_of_failure":"OtherFailure","blocking":[]} -->8.4.4https://gitlab.haskell.org/ghc/ghc/-/issues/15449Nondeterministic Failure on aarch64 with -jn, n > 12020-09-28T07:11:38ZTravis Whitakerpi.boy.travis@gmail.comNondeterministic Failure on aarch64 with -jn, n > 1GHC releases 8.2.1 through 8.4.3 exhibit various crashes when invoked with '-jn' where n \> 1. GHCHQ's binary releases have this behavior, as well as GHCs I've cross-built on my own.
In order to reproduce this issue there must be some p...GHC releases 8.2.1 through 8.4.3 exhibit various crashes when invoked with '-jn' where n \> 1. GHCHQ's binary releases have this behavior, as well as GHCs I've cross-built on my own.
In order to reproduce this issue there must be some parallelism in the module dependency graph; I've attached a test package for easily reproducing this. Use of deriving in the test modules isn't necessary to trigger this; it merely gives the compiler some work to do. The 'hscolour' package also triggers this issue reliably.
To trigger the bad behavior, simply run:
ghc --make -jn Main.hs -o test
with n \> 1 in the test-package. Running this repeatedly (removing .hi and .o files in between runs, of course), I've observed these outcomes with varying frequencies:
- Segmentation fault.
- Bus fault.
- Compiler process sleeps indefinitely.
-
```
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for aarch64-unknown-linux):
Binary.UserData: no put_binding_name
```
-
```
ghc: internal error: MUT_VAR_CLEAN object entered!
(GHC version 8.4.3 for aarch64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Aborted (core dumped)
```
- And most strangely:
```
A.hs:3:1: error:
• Kind signature on data type declaration has non-* return kind *
• In the data declaration for ‘A’
|
3 | data A = A
| ^^^^^^^^^^...
```
I have not noticed issues with any other concurrent Haskell programs on aarch64. I'm using the NVIDIA Jetson TX2 for these tests. I have not yet tried GHC 8.0.x, 8.6.x, or HEAD. I'm having trouble reproducing this in GDB; I'll report back when I've got that working.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Nondeterministic Failure on aarch64 with -jn, n > 1","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"GHC releases 8.2.1 through 8.4.3 exhibit various crashes when invoked with '-jn' where n > 1. GHCHQ's binary releases have this behavior, as well as GHCs I've cross-built on my own.\r\n\r\nIn order to reproduce this issue there must be some parallelism in the module dependency graph; I've attached a test package for easily reproducing this. Use of deriving in the test modules isn't necessary to trigger this; it merely gives the compiler some work to do. The 'hscolour' package also triggers this issue reliably.\r\n\r\nTo trigger the bad behavior, simply run:\r\n\r\nghc --make -jn Main.hs -o test\r\n\r\nwith n > 1 in the test-package. Running this repeatedly (removing .hi and .o files in between runs, of course), I've observed these outcomes with varying frequencies:\r\n\r\n- Segmentation fault.\r\n- Bus fault.\r\n- Compiler process sleeps indefinitely.\r\n- \r\n{{{\r\n<no location info>: error:\r\n ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for aarch64-unknown-linux):\r\n Binary.UserData: no put_binding_name\r\n}}}\r\n\r\n- \r\n{{{\r\n ghc: internal error: MUT_VAR_CLEAN object entered!\r\n (GHC version 8.4.3 for aarch64_unknown_linux)\r\n Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n Aborted (core dumped)\r\n}}}\r\n- And most strangely:\r\n{{{\r\nA.hs:3:1: error:\r\n • Kind signature on data type declaration has non-* return kind *\r\n • In the data declaration for ‘A’\r\n |\r\n3 | data A = A\r\n | ^^^^^^^^^^...\r\n}}}\r\n\r\nI have not noticed issues with any other concurrent Haskell programs on aarch64. I'm using the NVIDIA Jetson TX2 for these tests. I have not yet tried GHC 8.0.x, 8.6.x, or HEAD. I'm having trouble reproducing this in GDB; I'll report back when I've got that working.","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1Travis Whitakerpi.boy.travis@gmail.comTravis Whitakerpi.boy.travis@gmail.comhttps://gitlab.haskell.org/ghc/ghc/-/issues/15499Panic in occurence analysis phase (?), getRuntimeRep2019-07-07T18:04:28ZSerge KosyrevPanic in occurence analysis phase (?), getRuntimeRepCompiling this:
```hs
{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}
module Holo ()
where
data ADT (p :: Integer) where
ADT ::
{ a :: a
, b :: Integer
} -> ADT p
foo = undefined {b=undefined}
```
1. .yields:
```
ghc...Compiling this:
```hs
{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}
module Holo ()
where
data ADT (p :: Integer) where
ADT ::
{ a :: a
, b :: Integer
} -> ADT p
foo = undefined {b=undefined}
```
1. .yields:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
getRuntimeRep
p_a29z :: Integer
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1967:18 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
-v4 suggests this happend during the occurence analysis phase (log attached).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | goldfire, simonpj |
| Operating system | Linux |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panic in occurence analysis phase (?), getRuntimeRep","status":"New","operating_system":"Linux","component":"Compiler","related":[],"milestone":"8.4.4","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["goldfire","simonpj"],"type":"Bug","description":"Compiling this:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}\r\nmodule Holo ()\r\nwhere\r\n\r\ndata ADT (p :: Integer) where\r\n ADT ::\r\n { a :: a\r\n , b :: Integer\r\n } -> ADT p\r\n\r\nfoo = undefined {b=undefined}\r\n}}}\r\n\r\n..yields:\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n getRuntimeRep\r\n p_a29z :: Integer\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/types/Type.hs:1967:18 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\n-v4 suggests this happend during the occurence analysis phase (log attached).","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2Ryan ScottRyan Scotthttps://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/15517-O0 and pattern synonyms triggers panic in trimJoinCont2019-07-07T18:04:21ZSimon Jakobi-O0 and pattern synonyms triggers panic in trimJoinContRunning haddock on the [\`generics-mrsop\`](https://github.com/VictorCMiraldo/generics-mrsop) package results in
```
haddock: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
completeCall
fail_av9P
Se...Running haddock on the [\`generics-mrsop\`](https://github.com/VictorCMiraldo/generics-mrsop) package results in
```
haddock: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
completeCall
fail_av9P
Select nodup wild_00
Stop[BoringCtxt] Rep Singl (El FamRoseInt) (Lkup ix CodesRoseInt)
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/simplCore/Simplify.hs:1533:9 in ghc:Simplify
```
The same problem affects 8.6.1 and HEAD, but not 8.2.2.
The panic seems to stem from [this catch-all in \`trimJoinCont\`](https://github.com/ghc/ghc/blob/64c71ce956af3af593a46ef0d615c7f6fe6ecece/compiler/simplCore/Simplify.hs#L1613).8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15537Panic when building Crucible2019-07-07T18:04:15ZLangston BarrettPanic when building CrucibleI've encountered a panic, which GHC has asked me to report:
```
[19 of 21] Compiling Lang.Crucible.LLVM.Translation ( src/Lang/Crucible/LLVM/Translation.hs, dist/build/Lang/Crucible/LLVM/Translation.p_o )
<no location info>: error:
...I've encountered a panic, which GHC has asked me to report:
```
[19 of 21] Compiling Lang.Crucible.LLVM.Translation ( src/Lang/Crucible/LLVM/Translation.hs, dist/build/Lang/Crucible/LLVM/Translation.p_o )
<no location info>: error:
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
isUnliftedType
r_a4Zsg :: TYPE rep_a4Zsf
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1939:10 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
This was when compiling [crucible-llvm](https://github.com/GaloisInc/crucible/tree/master/crucible-llvm) revision 186mfb7wlz with GHC 8.4.3.
I'm building in Nix with a sandbox, so this should be easily reproducible. The Nix files are available here: https://github.com/siddharthist/galois-haskell-nix/tree/ghc-bug. Just run nix-build -A haskellPackages.crucible-llvm.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Panic when building Crucible","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I've encountered a panic, which GHC has asked me to report:\r\n{{{\r\n[19 of 21] Compiling Lang.Crucible.LLVM.Translation ( src/Lang/Crucible/LLVM/Translation.hs, dist/build/Lang/Crucible/LLVM/Translation.p_o )\r\n\r\n<no location info>: error:\r\n ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n isUnliftedType\r\n r_a4Zsg :: TYPE rep_a4Zsf\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/types/Type.hs:1939:10 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}\r\nThis was when compiling [https://github.com/GaloisInc/crucible/tree/master/crucible-llvm crucible-llvm] revision 186mfb7wlz with GHC 8.4.3.\r\n\r\nI'm building in Nix with a sandbox, so this should be easily reproducible. The Nix files are available here: https://github.com/siddharthist/galois-haskell-nix/tree/ghc-bug. Just run nix-build -A haskellPackages.crucible-llvm.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15549Core Lint error with EmptyCase2019-07-07T18:04:11ZRyan ScottCore Lint error with EmptyCaseThe following program gives a Core Lint error on GHC 8.2.2 and later:
```hs
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE UndecidableInstances #-}
...The following program gives a Core Lint error on GHC 8.2.2 and later:
```hs
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Kind
import Data.Void
data family Sing (a :: k)
data V1 :: Type -> Type
data instance Sing (z :: V1 p)
class Generic a where
type Rep a :: Type -> Type
to :: Rep a x -> a
class PGeneric a where
type To (z :: Rep a x) :: a
class SGeneric a where
sTo :: forall x (r :: Rep a x). Sing r -> Sing (To r :: a)
-----
instance Generic Void where
type Rep Void = V1
to x = case x of {}
type family EmptyCase (a :: j) :: k where
instance PGeneric Void where
type To x = EmptyCase x
instance SGeneric Void where
sTo x = case x of
```
```
$ /opt/ghc/8.4.3/bin/ghc Bug.hs -dcore-lint -fforce-recomp
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Simplifier ***
Bug.hs:38:7: warning:
[in body of lambda with binder x_aZ8 :: Sing r_a12q]
Kind application error in
coercion ‘(Sing (D:R:RepVoid[0] <x_a12p>_N) <r_a12q>_N)_R’
Function kind = forall k. k -> *
Arg kinds = [(V1 x_a12p, *), (r_a12q, Rep Void x_a12p)]
Fun: V1 x_a12p
(r_a12q, Rep Void x_a12p)
Bug.hs:38:7: warning:
[in body of lambda with binder x_aZ8 :: Sing r_a12q]
Kind application error in
coercion ‘D:R:SingV1z0[0] <x_a12p>_N <r_a12q>_N’
Function kind = V1 x_a12p -> *
Arg kinds = [(r_a12q, Rep Void x_a12p)]
Fun: V1 x_a12p
(r_a12q, Rep Void x_a12p)
Bug.hs:38:7: warning:
[in body of lambda with binder x_aZ8 :: Sing r_a12q]
Kind application error in
coercion ‘D:R:SingV1z0[0] <x_a12p>_N <r_a12q>_N’
Function kind = V1 x_a12p -> *
Arg kinds = [(r_a12q, Rep Void x_a12p)]
Fun: V1 x_a12p
(r_a12q, Rep Void x_a12p)
<no location info>: warning:
In the type ‘R:SingV1z x_a12p r_a12q’
Kind application error in type ‘R:SingV1z x_a12p r_a12q’
Function kind = forall p -> V1 p -> *
Arg kinds = [(x_a12p, *), (r_a12q, Rep Void x_a12p)]
Fun: V1 x_a12p
(r_a12q, Rep Void x_a12p)
<no location info>: warning:
In the type ‘R:SingV1z x_a12p r_a12q’
Kind application error in type ‘R:SingV1z x_a12p r_a12q’
Function kind = forall p -> V1 p -> *
Arg kinds = [(x_a12p, *), (r_a12q, Rep Void x_a12p)]
Fun: V1 x_a12p
(r_a12q, Rep Void x_a12p)
*** Offending Program ***
<elided>
$csTo_a12n :: forall x (r :: Rep Void x). Sing r -> Sing (To r)
[LclId,
Arity=1,
Str=<L,U>x,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]
$csTo_a12n
= \ (@ x_a12p)
(@ (r_a12q :: Rep Void x_a12p))
(x_aZ8 :: Sing r_a12q) ->
case x_aZ8
`cast` ((Sing
(D:R:RepVoid[0] <x_a12p>_N) <r_a12q>_N)_R ; D:R:SingV1z0[0]
<x_a12p>_N <r_a12q>_N
:: (Sing r_a12q :: *) ~R# (R:SingV1z x_a12p r_a12q :: *))
of nt_s13T {
}
```
GHC 8.0.2 does not appear to suffer from this Core Lint error.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.4.3 |
| Type | Bug |
| 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":"Core Lint error with empty closed type family","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["TypeFamilies,","TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program gives a Core Lint error on GHC 8.2.2 and later:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE EmptyCase #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Void\r\n\r\ndata family Sing (a :: k)\r\n\r\ndata V1 :: Type -> Type\r\ndata instance Sing (z :: V1 p)\r\n\r\nclass Generic a where\r\n type Rep a :: Type -> Type\r\n to :: Rep a x -> a\r\n\r\nclass PGeneric a where\r\n type To (z :: Rep a x) :: a\r\n\r\nclass SGeneric a where\r\n sTo :: forall x (r :: Rep a x). Sing r -> Sing (To r :: a)\r\n\r\n-----\r\n\r\ninstance Generic Void where\r\n type Rep Void = V1\r\n to x = case x of {}\r\n\r\ntype family EmptyCase (a :: j) :: k where\r\n\r\ninstance PGeneric Void where\r\n type To x = EmptyCase x\r\n\r\ninstance SGeneric Void where\r\n sTo x = case x of\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Bug.hs -dcore-lint -fforce-recomp \r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Simplifier ***\r\nBug.hs:38:7: warning:\r\n [in body of lambda with binder x_aZ8 :: Sing r_a12q]\r\n Kind application error in\r\n coercion ‘(Sing (D:R:RepVoid[0] <x_a12p>_N) <r_a12q>_N)_R’\r\n Function kind = forall k. k -> *\r\n Arg kinds = [(V1 x_a12p, *), (r_a12q, Rep Void x_a12p)]\r\n Fun: V1 x_a12p\r\n (r_a12q, Rep Void x_a12p)\r\nBug.hs:38:7: warning:\r\n [in body of lambda with binder x_aZ8 :: Sing r_a12q]\r\n Kind application error in\r\n coercion ‘D:R:SingV1z0[0] <x_a12p>_N <r_a12q>_N’\r\n Function kind = V1 x_a12p -> *\r\n Arg kinds = [(r_a12q, Rep Void x_a12p)]\r\n Fun: V1 x_a12p\r\n (r_a12q, Rep Void x_a12p)\r\nBug.hs:38:7: warning:\r\n [in body of lambda with binder x_aZ8 :: Sing r_a12q]\r\n Kind application error in\r\n coercion ‘D:R:SingV1z0[0] <x_a12p>_N <r_a12q>_N’\r\n Function kind = V1 x_a12p -> *\r\n Arg kinds = [(r_a12q, Rep Void x_a12p)]\r\n Fun: V1 x_a12p\r\n (r_a12q, Rep Void x_a12p)\r\n<no location info>: warning:\r\n In the type ‘R:SingV1z x_a12p r_a12q’\r\n Kind application error in type ‘R:SingV1z x_a12p r_a12q’\r\n Function kind = forall p -> V1 p -> *\r\n Arg kinds = [(x_a12p, *), (r_a12q, Rep Void x_a12p)]\r\n Fun: V1 x_a12p\r\n (r_a12q, Rep Void x_a12p)\r\n<no location info>: warning:\r\n In the type ‘R:SingV1z x_a12p r_a12q’\r\n Kind application error in type ‘R:SingV1z x_a12p r_a12q’\r\n Function kind = forall p -> V1 p -> *\r\n Arg kinds = [(x_a12p, *), (r_a12q, Rep Void x_a12p)]\r\n Fun: V1 x_a12p\r\n (r_a12q, Rep Void x_a12p)\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\n$csTo_a12n :: forall x (r :: Rep Void x). Sing r -> Sing (To r)\r\n[LclId,\r\n Arity=1,\r\n Str=<L,U>x,\r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]\r\n$csTo_a12n\r\n = \\ (@ x_a12p)\r\n (@ (r_a12q :: Rep Void x_a12p))\r\n (x_aZ8 :: Sing r_a12q) ->\r\n case x_aZ8\r\n `cast` ((Sing\r\n (D:R:RepVoid[0] <x_a12p>_N) <r_a12q>_N)_R ; D:R:SingV1z0[0]\r\n <x_a12p>_N <r_a12q>_N\r\n :: (Sing r_a12q :: *) ~R# (R:SingV1z x_a12p r_a12q :: *))\r\n of nt_s13T {\r\n }\r\n}}}\r\n\r\nGHC 8.0.2 does not appear to suffer from this Core Lint error.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15552Infinite loop/panic with an existential type.2019-07-07T18:04:11ZhowtonotwinInfinite loop/panic with an existential type.The symptoms of this bug are quite similar to #14723, but I don't know if the cause is exactly the same, ergo a new report.
To reproduce:
1. Make `T.hs`
```hs
{-# LANGUAGE DataKinds, ExistentialQuantification, GADTs, PolyKinds, TypeOp...The symptoms of this bug are quite similar to #14723, but I don't know if the cause is exactly the same, ergo a new report.
To reproduce:
1. Make `T.hs`
```hs
{-# LANGUAGE DataKinds, ExistentialQuantification, GADTs, PolyKinds, TypeOperators #-}
module T where
import Data.Kind
data Elem :: k -> [k] -> Type where
Here :: Elem x (x : xs)
There :: Elem x xs -> Elem x (y : xs)
data EntryOfVal (v :: Type) (kvs :: [Type]) = forall (k :: Type). EntryOfVal (Elem (k, v) kvs)
```
1. Compile it with `ghc T.hs -ddump-tc-trace`
```
# etc.
checkExpectedKind
*
TYPE t_aXd[tau:1]
<*>_N
kcLHsQTyVars: not-cusk
EntryOfVal
[]
[(k_aW0 :: Type)]
[]
[k_aW0[sk:1]]
*ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
kcConDecl
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
1. Append the following to `T.hs` (not minimized, sorry)
```hs
type family EntryOfValKey (eov :: EntryOfVal v kvs) :: Type where
EntryOfValKey ('EntryOfVal (_ :: Elem (k, v) kvs)) = k
type family GetEntryOfVal (eov :: EntryOfVal v kvs) :: Elem (EntryOfValKey eov, v) kvs where
GetEntryOfVal ('EntryOfVal e) = e
type family FirstEntryOfVal (v :: Type) (kvs :: [Type]) :: EntryOfVal v kvs where
FirstEntryOfVal v ((k, v) : _) = 'EntryOfVal Here
FirstEntryOfVal v (_ : kvs) = 'EntryOfVal (There (GetEntryOfVal (FirstEntryOfVal v kvs)))
```
1. Compile with a plain `ghc T.hs`
1. Wait until bored, then knock the compiler out of its infinite loop by killing it.
1. Compile again with `ghc T.hs -ddump-tc-trace`
```
# etc.
checkExpectedKind
*
TYPE t_aYg[tau:1]
<*>_N
kcLHsQTyVars: not-cuskghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-apple-darwin):
kcConDecl
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
Found while trying to answer [this SO question](https://stackoverflow.com/q/51944931/5684257).
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Infinite loop/panic with an existential type.","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The symptoms of this bug are quite similar to #14723, but I don't know if the cause is exactly the same, ergo a new report.\r\n\r\nTo reproduce:\r\n\r\n1. Make `T.hs`\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds, ExistentialQuantification, GADTs, PolyKinds, TypeOperators #-}\r\nmodule T where\r\n\r\nimport Data.Kind\r\n\r\ndata Elem :: k -> [k] -> Type where\r\n Here :: Elem x (x : xs)\r\n There :: Elem x xs -> Elem x (y : xs)\r\n\r\ndata EntryOfVal (v :: Type) (kvs :: [Type]) = forall (k :: Type). EntryOfVal (Elem (k, v) kvs)\r\n}}}\r\n\r\n2. Compile it with `ghc T.hs -ddump-tc-trace`\r\n{{{\r\n# etc.\r\ncheckExpectedKind\r\n *\r\n TYPE t_aXd[tau:1]\r\n <*>_N\r\nkcLHsQTyVars: not-cusk\r\n EntryOfVal\r\n []\r\n [(k_aW0 :: Type)]\r\n []\r\n [k_aW0[sk:1]]\r\n *ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-apple-darwin):\r\n\tkcConDecl\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\n3. Append the following to `T.hs` (not minimized, sorry)\r\n{{{#!hs\r\ntype family EntryOfValKey (eov :: EntryOfVal v kvs) :: Type where\r\n EntryOfValKey ('EntryOfVal (_ :: Elem (k, v) kvs)) = k\r\ntype family GetEntryOfVal (eov :: EntryOfVal v kvs) :: Elem (EntryOfValKey eov, v) kvs where\r\n GetEntryOfVal ('EntryOfVal e) = e\r\n\r\ntype family FirstEntryOfVal (v :: Type) (kvs :: [Type]) :: EntryOfVal v kvs where\r\n FirstEntryOfVal v ((k, v) : _) = 'EntryOfVal Here\r\n FirstEntryOfVal v (_ : kvs) = 'EntryOfVal (There (GetEntryOfVal (FirstEntryOfVal v kvs)))\r\n}}}\r\n\r\n4. Compile with a plain `ghc T.hs`\r\n 1. Wait until bored, then knock the compiler out of its infinite loop by killing it.\r\n5. Compile again with `ghc T.hs -ddump-tc-trace`\r\n{{{\r\n# etc.\r\ncheckExpectedKind\r\n *\r\n TYPE t_aYg[tau:1]\r\n <*>_N\r\nkcLHsQTyVars: not-cuskghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-apple-darwin):\r\n\tkcConDecl\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}\r\n\r\nFound while trying to answer [https://stackoverflow.com/q/51944931/5684257 this SO question].","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15586Compilation panic! (the 'impossible' happened)2019-07-07T18:04:01ZsubaruruCompilation panic! (the 'impossible' happened)See attached zip for entire project causing error. I'd imagine it's pretty reproducible, just call stack build. I'm running standard lts-12.8 and it's just two small files that don't do anything yet!
Also included is panicmessage.txt sho...See attached zip for entire project causing error. I'd imagine it's pretty reproducible, just call stack build. I'm running standard lts-12.8 and it's just two small files that don't do anything yet!
Also included is panicmessage.txt showing the exact output, crucially:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
piResultTy
*
v_XabT
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:947:35 in ghc:Type
```
Oh and sysinfo
```
uname -a
Linux @@@ 4.16.11-100.fc26.x86_64 #1 SMP Tue May 22 20:02:12 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Linux |
| Architecture | x86_64 (amd64) |
</details>
<!-- {"blocked_by":[],"summary":"Compilation panic! (the 'impossible' happened)","status":"New","operating_system":"Linux","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"x86_64 (amd64)","cc":[""],"type":"Bug","description":"See attached zip for entire project causing error. I'd imagine it's pretty reproducible, just call stack build. I'm running standard lts-12.8 and it's just two small files that don't do anything yet!\r\nAlso included is panicmessage.txt showing the exact output, crucially:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n\tpiResultTy\r\n *\r\n v_XabT\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/types/Type.hs:947:35 in ghc:Type\r\n\r\n}}}\r\n\r\nOh and sysinfo \r\n\r\n\r\n{{{\r\nuname -a\r\nLinux @@@ 4.16.11-100.fc26.x86_64 #1 SMP Tue May 22 20:02:12 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux\r\n}}}\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15597GHC shouting: panic!2019-07-07T18:03:54ZtstrGHC shouting: panic!This program makes the impossible happen:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeInType #-}
import GHC.Types
data Bug :: (f x -> Type) -> Type where
Bug :: forall
(r::h -> forall x. f x -> Type)
(a::f x)
. (r::...This program makes the impossible happen:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeInType #-}
import GHC.Types
data Bug :: (f x -> Type) -> Type where
Bug :: forall
(r::h -> forall x. f x -> Type)
(a::f x)
. (r::((f x -> Type) -> Type) -> forall x. f x -> Type) Bug a
-> Bug (r::f x -> Type)
```
And asked for reporting the error:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.1 for x86_64-unknown-linux):
piResultTy
k_aozeA[tau:1]
(x_aozeN[sk:2] |> {co_aozeO})
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:950:35 in ghc:Type
```
<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":"GHC shouting: panic!","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This program makes the impossible happen:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE TypeInType #-}\r\n\r\nimport GHC.Types\r\n\r\ndata Bug :: (f x -> Type) -> Type where\r\n Bug :: forall\r\n (r::h -> forall x. f x -> Type)\r\n (a::f x)\r\n . (r::((f x -> Type) -> Type) -> forall x. f x -> Type) Bug a\r\n -> Bug (r::f x -> Type)\r\n}}}\r\n\r\n\r\nAnd asked for reporting the error:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.1 for x86_64-unknown-linux):\r\n\tpiResultTy\r\n k_aozeA[tau:1]\r\n (x_aozeN[sk:2] |> {co_aozeO})\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/types/Type.hs:950:35 in ghc:Type\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15598RebindableSyntax with RankNTypes and type class method call yields panic.2024-02-05T22:50:46ZRoman BorschelRebindableSyntax with RankNTypes and type class method call yields panic.The following program in a file `ghc-panic.hs`
```hs
{-# LANGUAGE
GADTSyntax
, RankNTypes
, RebindableSyntax
#-}
import Prelude hiding ((>>=))
data InfDo where
InfDo :: String -> (forall a. a -> InfDo) -> InfDo
prog :: In...The following program in a file `ghc-panic.hs`
```hs
{-# LANGUAGE
GADTSyntax
, RankNTypes
, RebindableSyntax
#-}
import Prelude hiding ((>>=))
data InfDo where
InfDo :: String -> (forall a. a -> InfDo) -> InfDo
prog :: InfDo
prog = do
_ <- show (42 :: Int)
prog
where
(>>=) = InfDo
main :: IO ()
main = let x = prog in x `seq` return ()
```
when loaded into GHCi yields
```
λ> main
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
nameModule
system $dShow_abfY
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/basicTypes/Name.hs:241:3 in ghc:Name
```
and separate compilation yields
```
$ ghc ghc-panic.hs
[1 of 1] Compiling Main ( ghc-panic.hs, ghc-panic.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
StgCmmEnv: variable not found
$dShow_a1qI
local binds for:
$tcInfDo
$trModule
$tcInfDo1_r1th
$tcInfDo2_r1tH
$trModule1_r1tI
$trModule2_r1tJ
$trModule3_r1tK
$trModule4_r1tL
sat_s1E4
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv
```
The problem disappears when either the rank-2 type is removed from `InfDo` or when the call to `show` is replaced by a static string.
Besides 8.4.3, also reproduced with 8.6.0.20180714.
I believe it is somewhat related to [https://ghc.haskell.org/trac/ghc/ticket/14963](https://ghc.haskell.org/trac/ghc/ticket/14963)Apoorv IngleApoorv Inglehttps://gitlab.haskell.org/ghc/ghc/-/issues/15629"No skolem info" panic (GHC 8.6 only)2019-07-07T18:03:40ZRyan Scott"No skolem info" panic (GHC 8.6 only)The following program:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug wher...The following program:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Kind
import Data.Proxy
import GHC.Generics
data TyFun :: Type -> Type -> Type
type a ~> b = TyFun a b -> Type
infixr 0 ~>
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
data family Sing :: forall k. k -> Type
newtype instance Sing (f :: k1 ~> k2) =
SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }
singFun1 :: forall f. (forall t. Sing t -> Sing (Apply f t)) -> Sing f
singFun1 f = SLambda f
data From1Sym0 :: forall k (f :: k -> Type) (a :: k). f a ~> Rep1 f a
data To1Sym0 :: forall k (f :: k -> Type) (a :: k). Rep1 f a ~> f a
type family ((f :: b ~> c) :. (g :: a ~> b)) (x :: a) :: c where
(f :. g) x = Apply f (Apply g x)
data (.@#@$$$) :: forall b c a. (b ~> c) -> (a ~> b) -> (a ~> c)
type instance Apply (f .@#@$$$ g) x = (f :. g) x
(%.) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).
Sing f -> Sing g -> Sing x -> Sing ((f :. g) x)
(sf %. sg) sx = applySing sf (applySing sg sx)
(%.$$$) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).
Sing f -> Sing g -> Sing (f .@#@$$$ g)
sf %.$$$ sg = singFun1 (sf %. sg)
f :: forall (m :: Type -> Type) x. Proxy (m x) -> ()
f _ = ()
where
sFrom1Fun :: forall ab. Sing (From1Sym0 :: m ab ~> Rep1 m ab)
sFrom1Fun = undefined
sTo1Fun :: forall ab. Sing (To1Sym0 :: Rep1 m ab ~> m ab)
sTo1Fun = undefined
sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)
sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
```
Panics on GHC 8.6:
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:50:39: error:
• Expected kind ‘m z ~> Rep1 m ab1’,
but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’
• In the first argument of ‘(.@#@$$$)’, namely
‘(From1Sym0 :: m z ~> Rep1 m z)’
In the first argument of ‘Sing’, namely
‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)’
In the type signature:
sFrom1To1Fun :: forall ab.
Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)
|
50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:51:20: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.6.0.20180823 for x86_64-unknown-linux):
No skolem info:
[ab_a1UW[sk:1]]
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
```
But merely errors on GHC 8.4.3:
```
$ /opt/ghc/8.4.3/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:50:39: error:
• Expected kind ‘m z ~> Rep1 m ab2’,
but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’
• In the first argument of ‘(.@#@$$$)’, namely
‘(From1Sym0 :: m z ~> Rep1 m z)’
In the first argument of ‘Sing’, namely
‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)’
In the type signature:
sFrom1To1Fun :: forall ab.
Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab
~> Rep1 m ab)
|
50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bug.hs:51:20: error:
• Couldn't match type ‘ab1’ with ‘z1’
because type variable ‘z1’ would escape its scope
This (rigid, skolem) type variable is bound by
the type signature for:
sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)
at Bug.hs:50:5-112
Expected type: Sing From1Sym0
Actual type: Sing From1Sym0
• In the first argument of ‘(%.$$$)’, namely ‘sFrom1Fun’
In the expression: sFrom1Fun %.$$$ sTo1Fun
In an equation for ‘sFrom1To1Fun’:
sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
• Relevant bindings include
sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)
(bound at Bug.hs:51:5)
|
51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
| ^^^^^^^^^
Bug.hs:51:36: error:
• Couldn't match type ‘ab’ with ‘z1’
because type variable ‘z1’ would escape its scope
This (rigid, skolem) type variable is bound by
the type signature for:
sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)
at Bug.hs:50:5-112
Expected type: Sing To1Sym0
Actual type: Sing To1Sym0
• In the second argument of ‘(%.$$$)’, namely ‘sTo1Fun’
In the expression: sFrom1Fun %.$$$ sTo1Fun
In an equation for ‘sFrom1To1Fun’:
sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
• Relevant bindings include
sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)
(bound at Bug.hs:51:5)
|
51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun
| ^^^^^^^
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.1-beta1 |
| Type | Bug |
| 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":"\"No skolem info\" panic (GHC 8.6 only)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1-beta1","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\nimport Data.Proxy\r\nimport GHC.Generics\r\n\r\ndata TyFun :: Type -> Type -> Type\r\ntype a ~> b = TyFun a b -> Type\r\ninfixr 0 ~>\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\n\r\ndata family Sing :: forall k. k -> Type\r\nnewtype instance Sing (f :: k1 ~> k2) =\r\n SLambda { applySing :: forall t. Sing t -> Sing (Apply f t) }\r\nsingFun1 :: forall f. (forall t. Sing t -> Sing (Apply f t)) -> Sing f\r\nsingFun1 f = SLambda f\r\n\r\ndata From1Sym0 :: forall k (f :: k -> Type) (a :: k). f a ~> Rep1 f a\r\ndata To1Sym0 :: forall k (f :: k -> Type) (a :: k). Rep1 f a ~> f a\r\n\r\ntype family ((f :: b ~> c) :. (g :: a ~> b)) (x :: a) :: c where\r\n (f :. g) x = Apply f (Apply g x)\r\n\r\ndata (.@#@$$$) :: forall b c a. (b ~> c) -> (a ~> b) -> (a ~> c)\r\ntype instance Apply (f .@#@$$$ g) x = (f :. g) x\r\n\r\n(%.) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).\r\n Sing f -> Sing g -> Sing x -> Sing ((f :. g) x)\r\n(sf %. sg) sx = applySing sf (applySing sg sx)\r\n\r\n(%.$$$) :: forall a b c (f :: b ~> c) (g :: a ~> b) (x :: a).\r\n Sing f -> Sing g -> Sing (f .@#@$$$ g)\r\nsf %.$$$ sg = singFun1 (sf %. sg)\r\n\r\nf :: forall (m :: Type -> Type) x. Proxy (m x) -> ()\r\nf _ = ()\r\n where\r\n sFrom1Fun :: forall ab. Sing (From1Sym0 :: m ab ~> Rep1 m ab)\r\n sFrom1Fun = undefined\r\n\r\n sTo1Fun :: forall ab. Sing (To1Sym0 :: Rep1 m ab ~> m ab)\r\n sTo1Fun = undefined\r\n\r\n sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)\r\n sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n}}}\r\n\r\nPanics on GHC 8.6:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:50:39: error:\r\n • Expected kind ‘m z ~> Rep1 m ab1’,\r\n but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’\r\n • In the first argument of ‘(.@#@$$$)’, namely\r\n ‘(From1Sym0 :: m z ~> Rep1 m z)’\r\n In the first argument of ‘Sing’, namely\r\n ‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)’\r\n In the type signature:\r\n sFrom1To1Fun :: forall ab.\r\n Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)\r\n |\r\n50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nBug.hs:51:20: error:ghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.0.20180823 for x86_64-unknown-linux):\r\n No skolem info:\r\n [ab_a1UW[sk:1]]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/typecheck/TcErrors.hs:2891:5 in ghc:TcErrors\r\n}}}\r\n\r\nBut merely errors on GHC 8.4.3:\r\n\r\n{{{\r\n$ /opt/ghc/8.4.3/bin/ghc Bug.hs \r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n\r\nBug.hs:50:39: error:\r\n • Expected kind ‘m z ~> Rep1 m ab2’,\r\n but ‘(From1Sym0 :: m z ~> Rep1 m z)’ has kind ‘m z ~> Rep1 m z’\r\n • In the first argument of ‘(.@#@$$$)’, namely\r\n ‘(From1Sym0 :: m z ~> Rep1 m z)’\r\n In the first argument of ‘Sing’, namely\r\n ‘(((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)’\r\n In the type signature:\r\n sFrom1To1Fun :: forall ab.\r\n Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab\r\n ~> Rep1 m ab)\r\n |\r\n50 | sFrom1To1Fun :: forall ab. Sing (((From1Sym0 :: m z ~> Rep1 m z) .@#@$$$ To1Sym0) :: Rep1 m ab ~> Rep1 m ab)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nBug.hs:51:20: error:\r\n • Couldn't match type ‘ab1’ with ‘z1’\r\n because type variable ‘z1’ would escape its scope\r\n This (rigid, skolem) type variable is bound by\r\n the type signature for:\r\n sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n at Bug.hs:50:5-112\r\n Expected type: Sing From1Sym0\r\n Actual type: Sing From1Sym0\r\n • In the first argument of ‘(%.$$$)’, namely ‘sFrom1Fun’\r\n In the expression: sFrom1Fun %.$$$ sTo1Fun\r\n In an equation for ‘sFrom1To1Fun’:\r\n sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n • Relevant bindings include\r\n sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n (bound at Bug.hs:51:5)\r\n |\r\n51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n | ^^^^^^^^^\r\n\r\nBug.hs:51:36: error:\r\n • Couldn't match type ‘ab’ with ‘z1’\r\n because type variable ‘z1’ would escape its scope\r\n This (rigid, skolem) type variable is bound by\r\n the type signature for:\r\n sFrom1To1Fun :: forall z1 ab3. Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n at Bug.hs:50:5-112\r\n Expected type: Sing To1Sym0\r\n Actual type: Sing To1Sym0\r\n • In the second argument of ‘(%.$$$)’, namely ‘sTo1Fun’\r\n In the expression: sFrom1Fun %.$$$ sTo1Fun\r\n In an equation for ‘sFrom1To1Fun’:\r\n sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n • Relevant bindings include\r\n sFrom1To1Fun :: Sing (From1Sym0 .@#@$$$ To1Sym0)\r\n (bound at Bug.hs:51:5)\r\n |\r\n51 | sFrom1To1Fun = sFrom1Fun %.$$$ sTo1Fun\r\n | ^^^^^^^\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15647ghc: panic! (the 'impossible' happened)2019-07-07T18:03:36Zmonomonghc: panic! (the 'impossible' happened)```
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
initTc: unsolved constraints
WC {wc_insol =
[W] ask_an9K :: t_an9J[tau:1] (CHoleCan: ask)
[W] put_an9Q :: t_an9P[tau:1] (CHole...```
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-linux):
initTc: unsolved constraints
WC {wc_insol =
[W] ask_an9K :: t_an9J[tau:1] (CHoleCan: ask)
[W] put_an9Q :: t_an9P[tau:1] (CHoleCan: put)}
```
So this code derives an instance of the Decimal type incorrectly, but not sure if this is causing the error.
I have some nested records, which contain a few Decimals. I am trying to make them acidic.
```hs
instance SafeCopy (DecimalRaw a) where
putCopy (Decimal d) = contain $ safePut d
getCopy = contain $ Decimal <$> safeGet
deriveSafeCopy 0 'base ''Client
deriveSafeCopy 0 'base ''Article
deriveSafeCopy 0 'base ''ServerData
makeLenses ''ServerData
writeState :: String -> Update ServerData ()
writeState newValue
= put (ServerData newValue)
queryState :: Update ServerData String
queryState = do ServerData string <- ask
return string
makeAcidic ''ServerData ['writeState 'queryState]
```
<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! (the 'impossible' happened)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.0.2 for x86_64-unknown-linux):\r\n\tinitTc: unsolved constraints\r\n WC {wc_insol =\r\n [W] ask_an9K :: t_an9J[tau:1] (CHoleCan: ask)\r\n [W] put_an9Q :: t_an9P[tau:1] (CHoleCan: put)}\r\n}}}\r\n\r\nSo this code derives an instance of the Decimal type incorrectly, but not sure if this is causing the error.\r\n\r\nI have some nested records, which contain a few Decimals. I am trying to make them acidic.\r\n\r\n{{{#!hs\r\ninstance SafeCopy (DecimalRaw a) where\r\n putCopy (Decimal d) = contain $ safePut d\r\n getCopy = contain $ Decimal <$> safeGet\r\n\r\nderiveSafeCopy 0 'base ''Client\r\nderiveSafeCopy 0 'base ''Article\r\n\r\n\r\nderiveSafeCopy 0 'base ''ServerData\r\nmakeLenses ''ServerData\r\n\r\nwriteState :: String -> Update ServerData ()\r\nwriteState newValue\r\n = put (ServerData newValue)\r\nqueryState :: Update ServerData String\r\nqueryState = do ServerData string <- ask\r\n return string\r\n\r\nmakeAcidic ''ServerData ['writeState 'queryState]\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15648Core Lint error with source-level unboxed equality2019-07-07T18:03:36ZRyan ScottCore Lint error with source-level unboxed equalityI thought that we had killed `(~#)` from the source language in #15209. I could not have been more wrong. Source-level `(~#)` is alive and well, and it can cause Core Lint errors. Be afraid. Be very, very afraid.
The trick is to grab `(...I thought that we had killed `(~#)` from the source language in #15209. I could not have been more wrong. Source-level `(~#)` is alive and well, and it can cause Core Lint errors. Be afraid. Be very, very afraid.
The trick is to grab `(~#)` using Template Haskell:
```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" "~#"
```
Once this is done, you can plop unboxed equality wherever you want into the source language. Here is a particularly mischievous example:
```hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind (Type)
import Data.Type.Equality (type (~~))
import Foo (ueqT)
data LegitEquality :: Type -> Type -> Type where
Legit :: LegitEquality a a
data JankyEquality :: Type -> Type -> Type where
Jank :: $ueqT a b -> JankyEquality a b
unJank :: JankyEquality a b -> $ueqT a b
unJank (Jank x) = x
legitToJank :: LegitEquality a b -> JankyEquality a b
legitToJank Legit = Jank
mkLegit :: a ~~ b => LegitEquality a b
mkLegit = Legit
ueqSym :: forall (a :: Type) (b :: Type).
$ueqT a b -> $ueqT b a
ueqSym = unJank $ legitToJank $ mkLegit @b @a
```
If you compile this with optimizations, then GHC's inner demons are unleashed, which brings utter chaos when `-dcore-lint` is enabled:
```
$ /opt/ghc/8.6.1/bin/ghc -O2 -fforce-recomp Bug.hs -dcore-lint
[1 of 2] Compiling Foo ( Foo.hs, Foo.o )
[2 of 2] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[in body of lambda with binder co_a5RY :: a_a5RV ~# b_a5RW]
x_a5OX :: b_a5RW ~# a_a5RV
[LclId] is out of scope
*** Offending Program ***
<elided>
ueqSym :: forall a b. (a ~# b) => b ~# a
[LclIdX,
Arity=1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]
ueqSym
= \ (@ a_a5RV) (@ b_a5RW) (co_a5RY :: a_a5RV ~# b_a5RW) -> x_a5OX
```
-----
Obviously, this ticket is a little tongue-in-cheek, since I'm probably inviting disaster upon myself by deliberately digging around in `ghc-prim` for `(~#)`. But this does raise the question: should we allow users to do this? I used to think that there was no harm in leaving `(~#)` lying at the bottom of the catacombs that is `ghc-prim`, but this example shows that perhaps `(~#)` should be locked away for good.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"Core Lint error with source-level unboxed equality","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I thought that we had killed `(~#)` from the source language in #15209. I could not have been more wrong. Source-level `(~#)` is alive and well, and it can cause Core Lint errors. Be afraid. Be very, very afraid.\r\n\r\nThe trick is to grab `(~#)` using Template Haskell:\r\n\r\n{{{#!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\r\nOnce this is done, you can plop unboxed equality wherever you want into the source language. Here is a particularly mischievous example:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE KindSignatures #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TemplateHaskell #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind (Type)\r\nimport Data.Type.Equality (type (~~))\r\nimport Foo (ueqT)\r\n\r\ndata LegitEquality :: Type -> Type -> Type where\r\n Legit :: LegitEquality a a\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\nlegitToJank :: LegitEquality a b -> JankyEquality a b\r\nlegitToJank Legit = Jank\r\n\r\nmkLegit :: a ~~ b => LegitEquality a b\r\nmkLegit = Legit\r\n\r\nueqSym :: forall (a :: Type) (b :: Type).\r\n $ueqT a b -> $ueqT b a\r\nueqSym = unJank $ legitToJank $ mkLegit @b @a\r\n}}}\r\n\r\nIf you compile this with optimizations, then GHC's inner demons are unleashed, which brings utter chaos when `-dcore-lint` is enabled:\r\n\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc -O2 -fforce-recomp Bug.hs -dcore-lint \r\n[1 of 2] Compiling Foo ( Foo.hs, Foo.o )\r\n[2 of 2] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n [in body of lambda with binder co_a5RY :: a_a5RV ~# b_a5RW]\r\n x_a5OX :: b_a5RW ~# a_a5RV\r\n [LclId] is out of scope\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\nueqSym :: forall a b. (a ~# b) => b ~# a\r\n[LclIdX,\r\n Arity=1,\r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,\r\n WorkFree=True, Expandable=True,\r\n Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]\r\nueqSym\r\n = \\ (@ a_a5RV) (@ b_a5RW) (co_a5RY :: a_a5RV ~# b_a5RW) -> x_a5OX\r\n}}}\r\n\r\n-----\r\n\r\nObviously, this ticket is a little tongue-in-cheek, since I'm probably inviting disaster upon myself by deliberately digging around in `ghc-prim` for `(~#)`. But this does raise the question: should we allow users to do this? I used to think that there was no harm in leaving `(~#)` lying at the bottom of the catacombs that is `ghc-prim`, but this example shows that perhaps `(~#)` should be locked away for good.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15666Dependent type synonym in recursive type family causes GHC to panic2019-07-07T18:03:32ZtydeuDependent type synonym in recursive type family causes GHC to panic# Background
I had written the following code in Haskell (GHC):
```hs
{-# LANGUAGE
NoImplicitPrelude,
TypeInType, PolyKinds, DataKinds,
ScopedTypeVariables,
TypeFamilies,
UndecidableInstances
#-}
import Data.Kind(Type)
dat...# Background
I had written the following code in Haskell (GHC):
```hs
{-# LANGUAGE
NoImplicitPrelude,
TypeInType, PolyKinds, DataKinds,
ScopedTypeVariables,
TypeFamilies,
UndecidableInstances
#-}
import Data.Kind(Type)
data PolyType k (t :: k)
type Wrap (t :: k) = PolyType k t
type Unwrap pt = (GetType pt :: GetKind pt)
type family GetKind (pt :: Type) :: Type where
GetKind (PolyType k t) = k
type family GetType (pt :: Type) :: k where
GetType (PolyType k t) = t
```
The intention of this code is to allow me to wrap a type of an arbitrary kind
into a type (namely `PolyType`) of a single kind (namely `Type`) and then
reverse the process (i.e. unwrap it) later.
# Problem
I wanted to define a function that would recursively operate on a composite type like so:
```hs
data Composite :: a -> b -> Type
type family RecursiveWrap expr where
RecursiveWrap (Composite a b) =
Wrap (Composite (Unwrap (RecursiveWrap a)) (Unwrap (RecursiveWrap b)))
RecursiveWrap x = Wrap x
```
However, the above definition causes GHC to panic:
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-mingw32):
cyclic evaluation in fixIO
```
# Ideas
If we inline the the `Unwrap` synoynm into the defintion of the type family
above like so:
```hs
type family RecursiveWrap expr where
RecursiveWrap (Composite a b) =
Wrap (Composite
(GetType (RecursiveWrap a) :: GetKind (RecursiveWrap a))
(GetType (RecursiveWrap a) :: GetKind (RecursiveWrap a))
)
RecursiveWrap x = Wrap x
```
GHC instead simply produces an error:
```
* Type constructor `RecursiveWrap' cannot be used here
(it is defined and used in the same recursive group)
* In the first argument of `GetKind', namely `(RecursiveWrap a)'
In the kind `GetKind (RecursiveWrap a)'
In the first argument of `Composite', namely
`(GetType (RecursiveWrap a) :: GetKind (RecursiveWrap a))'
```
As such, I suspect this has to do with the recursive type family appearing in
the kind signature when the `Unwrap` type synonym is expanded.
However, it strikes me as odd that even the above code errors. Since with the
`UndecidableInstances` extension turned on, I think that I should be able to
write recursive type families like the above. Especially given that the above
family would not loop indefinitely and thus be reducible.8.6.1https://gitlab.haskell.org/ghc/ghc/-/issues/15692GHC panic from pattern synonyms + deferred type errors2019-07-07T18:03:25ZIcelandjackGHC panic from pattern synonyms + deferred type errors```hs
{-# Language DataKinds, TypeOperators, PolyKinds, PatternSynonyms, GADTs #-}
{-# Options_GHC -dcore-lint -fdefer-type-errors #-}
import Data.Kind
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a...```hs
{-# Language DataKinds, TypeOperators, PolyKinds, PatternSynonyms, GADTs #-}
{-# Options_GHC -dcore-lint -fdefer-type-errors #-}
import Data.Kind
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a -> as)
data ApplyT (k::Type) :: k -> Ctx(k) -> Type where
AO :: a -> ApplyT(Type) a E
AS :: ApplyT(ks) (f a) ctx
-> ApplyT(k -> ks) f (a:&:ctx)
pattern ASSO = AS (AS (AO False))
```
```
$ ghci -ignore-dot-ghci 463.hs
hs/463.hs:16:27: warning: [-Wdeferred-type-errors]
• Couldn't match type ‘a a1 a2’ with ‘Bool’
Expected type: a3
Actual type: Bool
• In the pattern: False
In the pattern: AO False
In the pattern: AS (AO False)
|
16 | pattern ASSO = AS (AS (AO False))
| ^^^^^
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20180828 for x86_64-unknown-linux):
urk! lookup local fingerprint
$mASSO
[iESflb :-> ($trModule, 1ca40dc83a9c879effdb760462cc9a2d),
iESgKD :-> ($tc'E, 79f67a27a14dc1bb6eecb39e4b061e2c),
iESgKF :-> ($tc':&:, 24793c0c1652ffcf92e04f47d38fa075),
iESgKH :-> ($tcCtx, a3f9358cbfe161bf59e75500d70ce0ae),
iESgKI :-> ($tc'AO, 72111d1891cb082e989c20a2191a8b4b),
iESgKK :-> ($tc'AS, ff019c04c400d5fbdd46ff8a816d4913),
iESgKM :-> ($tcApplyT, cbfe28374b4115925c7213e6330ab115)]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/iface/MkIface.hs:524:37 in ghc:MkIface
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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 panic from pattern synonyms + deferred type errors","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["PatternSynonyms,","TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# Language DataKinds, TypeOperators, PolyKinds, PatternSynonyms, GADTs #-}\r\n\r\n{-# Options_GHC -dcore-lint -fdefer-type-errors #-}\r\n\r\nimport Data.Kind\r\n\r\ndata Ctx :: Type -> Type where\r\n E :: Ctx(Type)\r\n (:&:) :: a -> Ctx(as) -> Ctx(a -> as)\r\n\r\ndata ApplyT (k::Type) :: k -> Ctx(k) -> Type where\r\n AO :: a -> ApplyT(Type) a E\r\n AS :: ApplyT(ks) (f a) ctx\r\n -> ApplyT(k -> ks) f (a:&:ctx)\r\n\r\npattern ASSO = AS (AS (AO False))\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 463.hs\r\nhs/463.hs:16:27: warning: [-Wdeferred-type-errors]\r\n • Couldn't match type ‘a a1 a2’ with ‘Bool’\r\n Expected type: a3\r\n Actual type: Bool\r\n • In the pattern: False\r\n In the pattern: AO False\r\n In the pattern: AS (AO False)\r\n |\r\n16 | pattern ASSO = AS (AS (AO False))\r\n | ^^^^^\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20180828 for x86_64-unknown-linux):\r\n\turk! lookup local fingerprint\r\n $mASSO\r\n [iESflb :-> ($trModule, 1ca40dc83a9c879effdb760462cc9a2d),\r\n iESgKD :-> ($tc'E, 79f67a27a14dc1bb6eecb39e4b061e2c),\r\n iESgKF :-> ($tc':&:, 24793c0c1652ffcf92e04f47d38fa075),\r\n iESgKH :-> ($tcCtx, a3f9358cbfe161bf59e75500d70ce0ae),\r\n iESgKI :-> ($tc'AO, 72111d1891cb082e989c20a2191a8b4b),\r\n iESgKK :-> ($tc'AS, ff019c04c400d5fbdd46ff8a816d4913),\r\n iESgKM :-> ($tcApplyT, cbfe28374b4115925c7213e6330ab115)]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/iface/MkIface.hs:524:37 in ghc:MkIface\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> \r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15695Core Lint error, from -fobject-code + defer type errors + pattern synonyms + ...2019-07-07T18:03:25ZIcelandjackCore Lint error, from -fobject-code + defer type errors + pattern synonyms + other stuffTry running this (`-fobject-code` is required) with **and** without `-dcore-lint`. I tried to minimize it but it is still hefty. This is showing it without `-dcore-lint`:
```hs
{-# Language RankNTypes, PatternSynonyms, DataKinds, PolyKi...Try running this (`-fobject-code` is required) with **and** without `-dcore-lint`. I tried to minimize it but it is still hefty. This is showing it without `-dcore-lint`:
```hs
{-# Language RankNTypes, PatternSynonyms, DataKinds, PolyKinds, GADTs, TypeOperators, MultiParamTypeClasses, TypeFamilies, TypeSynonymInstances, FlexibleInstances, InstanceSigs, FlexibleContexts #-}
{-# Options_GHC -fdefer-type-errors #-}
import Data.Kind
import Data.Type.Equality
data TyVar :: Type -> Type -> Type where
VO :: TyVar (a -> as) a
VS :: TyVar as a -> TyVar (b -> as) a
data NP :: (k -> Type) -> ([k] -> Type) where
Nil :: NP f '[]
(:*) :: f a -> NP f as -> NP f (a:as)
data NS :: (k -> Type) -> ([k] -> Type) where
Here :: f a -> NS f (a:as)
There :: NS f as -> NS f (a:as)
infixr 6 :&:
data Ctx :: Type -> Type where
E :: Ctx(Type)
(:&:) :: a -> Ctx(as) -> Ctx(a -> as)
data NA a
type SOP(kind::Type) code = NS (NP NA) code
data ApplyT(kind::Type) :: kind -> Ctx(kind) -> Type where
AO :: a -> ApplyT(Type) a E
AS :: ApplyT(ks) (f a) ctx
-> ApplyT(k -> ks) f (a:&:ctx)
from' :: ApplyT(Type -> Type -> Type) Either ctx -> NS (NP NA) '[ '[VO] ]
from' (ASSO (Left a)) = Here (a :* Nil)
from' (ASSO (Right b)) = There (Here undefined)
pattern ASSO
:: () =>
forall (ks :: Type) k (f :: k -> ks) (a1 :: k) (ks1 :: Type) k1 (f1 :: k1 -> ks1) (a2 :: k1) a3.
(kind ~ (k -> k1 -> Type), a ~~ f, b ~~ (a1 :&: a2 :&: E),
f a1 ~~ f1, f1 a2 ~~ a3) =>
a3 -> ApplyT kind a b
pattern ASSO a = AS (AS (AO a))
```
```
$ ghci -ignore-dot-ghci -fobject-code 466.hs
GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 466.hs, 466.o )
466.hs:35:14: warning: [-Wdeferred-type-errors]
• Could not deduce: a2 ~ NA 'VO
from the context: ((* -> * -> *) ~ (k1 -> k2 -> *), Either ~~ f,
ctx ~~ (a2 ':&: (a3 ':&: 'E)), f a2 ~~ f1, f1 a3 ~~ a4)
bound by a pattern with pattern synonym:
ASSO :: forall kind (a :: kind) (b :: Ctx kind).
() =>
forall ks k (f :: k -> ks) (a1 :: k) ks1 k1 (f1 :: k1
-> ks1) (a2 :: k1) a3.
(kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 ':&: (a2 ':&: 'E)),
f a1 ~~ f1, f1 a2 ~~ a3) =>
a3 -> ApplyT kind a b,
in an equation for ‘from'’
at 466.hs:35:8-21
‘a2’ is a rigid type variable bound by
a pattern with pattern synonym:
ASSO :: forall kind (a :: kind) (b :: Ctx kind).
() =>
forall ks k (f :: k -> ks) (a1 :: k) ks1 k1 (f1 :: k1
-> ks1) (a2 :: k1) a3.
(kind ~ (k -> k1 -> *), a ~~ f, b ~~ (a1 ':&: (a2 ':&: 'E)),
f a1 ~~ f1, f1 a2 ~~ a3) =>
a3 -> ApplyT kind a b,
in an equation for ‘from'’
at 466.hs:35:8-21
Expected type: a4
Actual type: Either (NA 'VO) a3
• In the pattern: Left a
In the pattern: ASSO (Left a)
In an equation for ‘from'’: from' (ASSO (Left a)) = Here (a :* Nil)
• Relevant bindings include
from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[ 'VO]]
(bound at 466.hs:35:1)
|
35 | from' (ASSO (Left a)) = Here (a :* Nil)
| ^^^^^^^
466.hs:36:26: warning: [-Wdeferred-type-errors]
• Couldn't match type ‘a0 : as0’ with ‘'[]’
Expected type: NS (NP NA) '[ '[ 'VO]]
Actual type: NS (NP NA) ('[ 'VO] : a0 : as0)
• In the expression: There (Here undefined)
In an equation for ‘from'’:
from' (ASSO (Right b)) = There (Here undefined)
• Relevant bindings include
from' :: ApplyT (* -> * -> *) Either ctx -> NS (NP NA) '[ '[ 'VO]]
(bound at 466.hs:35:1)
|
36 | from' (ASSO (Right b)) = There (Here undefined)
| ^^^^^^^^^^^^^^^^^^^^^^
WARNING: file compiler/types/TyCoRep.hs, line 2378
in_scope InScope {wild_00 wild_Xl wild_Xv wild_X1m a_a1Gv ks_a1Ou
k_a1Ov f_a1Ow a_a1Ox ctx_a1Oy co_a1Oz co_a1OA co_a1OB ks_a1OC
k_a1OD f_a1OE a_a1OF ctx_a1OG co_a1OH co_a1OI co_a1OJ a_a1OK
co_a1OL co_a1OM co_a1ON as_a1Q3 a_a1Q4 ctx_a1Q5 $krep_a2XW
$krep_a2XX $krep_a2XY $krep_a2XZ $krep_a2Y0 $krep_a2Y1 $krep_a2Y2
$krep_a2Y3 $krep_a2Y4 $krep_a2Y5 $krep_a2Y6 $krep_a2Y7 $krep_a2Y8
$krep_a2Y9 $krep_a2Ya $krep_a2Yb $krep_a2Yc $krep_a2Yd $krep_a2Ye
$krep_a2Yf $krep_a2Yg $krep_a2Yh $krep_a2Yi $krep_a2Yj $krep_a2Yk
$krep_a2Yl $krep_a2Ym $krep_a2Yn $krep_a2Yo $krep_a2Yp $krep_a2Yq
$krep_a2Yr $krep_a2Ys $krep_a2Yt $krep_a2Yu $krep_a2Yv $krep_a2Yw
$krep_a2Yx $krep_a2Yy $krep_a2Yz $krep_a2YA $krep_a2YB $krep_a2YC
$krep_a2YD $krep_a2YE $krep_a2YF $krep_a2YG $krep_a2YH $krep_a2YI
$krep_a2YJ $krep_a2YK $krep_a2YL ds_d2YO ds_d2YP ds_d2YV fail_d2Z2
from' $bASSO $mASSO $tc':&: $tc':* $tc'AO $tc'AS $tc'E $tc'Here
$tc'Nil $tc'There $tc'VO $tc'VS $tcApplyT $tcCtx $tcNA $tcNP $tcNS
$tcTyVar $trModule $trModule_s2ZM $trModule_s2ZN $trModule_s2ZO
$trModule_s2ZP $krep_s2ZQ $krep_s2ZR $krep_s2ZS $krep_s2ZT
$krep_s2ZU $krep_s2ZV $krep_s2ZW $krep_s2ZX $tcTyVar_s2ZY
$tcTyVar_s2ZZ $krep_s300 $krep_s301 $krep_s302 $krep_s303
$tc'VO_s304 $tc'VO_s305 $krep_s306 $krep_s307 $tc'VS_s308
$tc'VS_s309 $tcNP_s30a $tcNP_s30b $krep_s30c $krep_s30d $krep_s30e
$krep_s30f $krep_s30g $krep_s30h $tc':*_s30i $tc':*_s30j $krep_s30k
$krep_s30l $krep_s30m $tc'Nil_s30n $tc'Nil_s30o $tcNS_s30p
$tcNS_s30q $krep_s30r $krep_s30s $krep_s30t $krep_s30u $krep_s30v
$krep_s30w $tc'Here_s30x $tc'Here_s30y $krep_s30z $krep_s30A
$krep_s30B $tc'There_s30C $tc'There_s30D $tcCtx_s30E $tcCtx_s30F
$krep_s30G $krep_s30H $krep_s30I $tc':&:_s30J $tc':&:_s30K
$krep_s30L $krep_s30M $krep_s30N $krep_s30O $krep_s30P $tc'E_s30Q
$tc'E_s30R $tcNA_s30S $tcNA_s30T $tcApplyT_s30U $tcApplyT_s30V
$krep_s30W $krep_s30X $krep_s30Y $krep_s30Z $krep_s310 $krep_s311
$tc'AS_s312 $tc'AS_s313 $krep_s314 $krep_s315 $krep_s316
$tc'AO_s317 $tc'AO_s318}
tenv [a1Ow :-> f_a1Ow, a1Ox :-> a_a1Ox, a1Oy :-> ctx_a1Oy,
a1OE :-> f_a1OE, a1OF :-> a_a1OF, a1OG :-> ctx_a1OG]
cenv [a1Oz :-> co_a1Oz, a1OA :-> co_a1OA, a1OB :-> co_a1OB,
a1OH :-> co_a1OH, a1OI :-> co_a1OI, a1OJ :-> co_a1OJ,
a1OL :-> co_a1OL, a1OM :-> co_a1OM, a1ON :-> co_a1ON]
tys [a_a1Ox ~# (NA 'VO |> Sym (Nth:2 (Sym co_a2U0)))]
cos []
needInScope [a1Ov :-> k_a1Ov, a1OD :-> k_a1OD, a1Q3 :-> as_a1Q3,
a1Q4 :-> a_a1Q4, a2U0 :-> co_a2U0]
WARNING: file compiler/types/TyCoRep.hs, line 2378
in_scope InScope {wild_00 wild_Xl wild_Xv wild_X1m a_a1Gv ks_a1Ou
k_a1Ov f_a1Ow a_a1Ox ctx_a1Oy co_a1Oz co_a1OA co_a1OB ks_a1OC
k_a1OD f_a1OE a_a1OF ctx_a1OG co_a1OH co_a1OI co_a1OJ a_a1OK
co_a1OL co_a1OM co_a1ON as_a1Q3 a_a1Q4 ctx_a1Q5 $krep_a2XW
$krep_a2XX $krep_a2XY $krep_a2XZ $krep_a2Y0 $krep_a2Y1 $krep_a2Y2
$krep_a2Y3 $krep_a2Y4 $krep_a2Y5 $krep_a2Y6 $krep_a2Y7 $krep_a2Y8
$krep_a2Y9 $krep_a2Ya $krep_a2Yb $krep_a2Yc $krep_a2Yd $krep_a2Ye
$krep_a2Yf $krep_a2Yg $krep_a2Yh $krep_a2Yi $krep_a2Yj $krep_a2Yk
$krep_a2Yl $krep_a2Ym $krep_a2Yn $krep_a2Yo $krep_a2Yp $krep_a2Yq
$krep_a2Yr $krep_a2Ys $krep_a2Yt $krep_a2Yu $krep_a2Yv $krep_a2Yw
$krep_a2Yx $krep_a2Yy $krep_a2Yz $krep_a2YA $krep_a2YB $krep_a2YC
$krep_a2YD $krep_a2YE $krep_a2YF $krep_a2YG $krep_a2YH $krep_a2YI
$krep_a2YJ $krep_a2YK $krep_a2YL ds_d2YO ds_d2YP ds_d2YV fail_d2Z2
from' $bASSO $mASSO $tc':&: $tc':* $tc'AO $tc'AS $tc'E $tc'Here
$tc'Nil $tc'There $tc'VO $tc'VS $tcApplyT $tcCtx $tcNA $tcNP $tcNS
$tcTyVar $trModule $trModule_s2ZM $trModule_s2ZN $trModule_s2ZO
$trModule_s2ZP $krep_s2ZQ $krep_s2ZR $krep_s2ZS $krep_s2ZT
$krep_s2ZU $krep_s2ZV $krep_s2ZW $krep_s2ZX $tcTyVar_s2ZY
$tcTyVar_s2ZZ $krep_s300 $krep_s301 $krep_s302 $krep_s303
$tc'VO_s304 $tc'VO_s305 $krep_s306 $krep_s307 $tc'VS_s308
$tc'VS_s309 $tcNP_s30a $tcNP_s30b $krep_s30c $krep_s30d $krep_s30e
$krep_s30f $krep_s30g $krep_s30h $tc':*_s30i $tc':*_s30j $krep_s30k
$krep_s30l $krep_s30m $tc'Nil_s30n $tc'Nil_s30o $tcNS_s30p
$tcNS_s30q $krep_s30r $krep_s30s $krep_s30t $krep_s30u $krep_s30v
$krep_s30w $tc'Here_s30x $tc'Here_s30y $krep_s30z $krep_s30A
$krep_s30B $tc'There_s30C $tc'There_s30D $tcCtx_s30E $tcCtx_s30F
$krep_s30G $krep_s30H $krep_s30I $tc':&:_s30J $tc':&:_s30K
$krep_s30L $krep_s30M $krep_s30N $krep_s30O $krep_s30P $tc'E_s30Q
$tc'E_s30R $tcNA_s30S $tcNA_s30T $tcApplyT_s30U $tcApplyT_s30V
$krep_s30W $krep_s30X $krep_s30Y $krep_s30Z $krep_s310 $krep_s311
$tc'AS_s312 $tc'AS_s313 $krep_s314 $krep_s315 $krep_s316
$tc'AO_s317 $tc'AO_s318}
tenv [a1Ow :-> f_a1Ow, a1Ox :-> a_a1Ox, a1Oy :-> ctx_a1Oy,
a1OE :-> f_a1OE, a1OF :-> a_a1OF, a1OG :-> ctx_a1OG]
cenv [a1Oz :-> co_a1Oz, a1OA :-> co_a1OA, a1OB :-> co_a1OB,
a1OH :-> co_a1OH, a1OI :-> co_a1OI, a1OJ :-> co_a1OJ,
a1OL :-> co_a1OL, a1OM :-> co_a1OM, a1ON :-> co_a1ON]
tys [a_a1Ox ~# (NA 'VO |> Sym (Nth:2 (Sym co_a2U0)))]
cos []
needInScope [a1Ov :-> k_a1Ov, a1OD :-> k_a1OD, a1Q3 :-> as_a1Q3,
a1Q4 :-> a_a1Q4, a2U0 :-> co_a2U0]
Ok, one module loaded.
Prelude Main>
```8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15700Plugins cause GHC to panic: cannot find dynamic libraries2019-07-07T18:03:23Zsheafsam.derbyshire@gmail.comPlugins cause GHC to panic: cannot find dynamic librariesWith GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492.
Trying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin:
```
ghc.EXE: panic! (the 'impossible' happene...With GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492.
Trying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin:
```
ghc.EXE: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-mingw32):
mkPluginUsage: no dylibs, tried:
C:\Code\Haskell\dylibs_bug\.stack-work\install\df4dd97d\lib\x86_64-windows-ghc-8.6.1\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll
C:\Users\Sam\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll
C:\Users\Sam\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll
GHC.TypeLits.Normalise
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler\\deSugar\\DsUsage.hs:179:15 in ghc:DsUsage
```
That's with stack. I also checked with Cabal 2.4.0.1 to make sure, and indeed I get:
```
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-mingw32):
mkPluginUsage: no dylibs, tried:
C:\Users\Sam\AppData\Roaming\cabal\store\ghc-8.6.1\ghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0\lib\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll
C:\Program Files\ghc\mingw\lib\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll
GHC.TypeLits.Normalise
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\utils\Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler\\deSugar\\DsUsage.hs:179:15 in ghc:DsUsage
```
No problems with GHC 8.4.3.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Plugins cause GHC to panic: cannot find dynamic libraries","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"With GHC 8.6.1 on Windows 7 x64, I seem to be getting a similar problem as in ticket #15492.\r\nTrying to use any type-checking plugin at all causes an error. Here with the natnormalise plugin:\r\n\r\n{{{\r\nghc.EXE: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-mingw32):\r\n mkPluginUsage: no dylibs, tried:\r\nC:\\Code\\Haskell\\dylibs_bug\\.stack-work\\install\\df4dd97d\\lib\\x86_64-windows-ghc-8.6.1\\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll\r\nC:\\Users\\Sam\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20180531\\mingw64\\bin\\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll\r\nC:\\Users\\Sam\\AppData\\Local\\Programs\\stack\\x86_64-windows\\msys2-20180531\\mingw64\\lib\\libHSghc-typelits-natnormalise-0.6.3-2vTVlu0GX1Q1cNTbomjNL6-ghc8.6.1.dll\r\n\r\n GHC.TypeLits.Normalise\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler\\utils\\Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler\\\\deSugar\\\\DsUsage.hs:179:15 in ghc:DsUsage\r\n}}}\r\n\r\n\r\nThat's with stack. I also checked with Cabal 2.4.0.1 to make sure, and indeed I get:\r\n\r\n{{{\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-mingw32):\r\n mkPluginUsage: no dylibs, tried:\r\nC:\\Users\\Sam\\AppData\\Roaming\\cabal\\store\\ghc-8.6.1\\ghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0\\lib\\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll\r\nC:\\Program Files\\ghc\\mingw\\lib\\libHSghc-typelits-_-0.6.2-faf29727b3dbdfa09cfb6f0c881a2a227b5d2bb0-ghc8.6.1.dll\r\n\r\n GHC.TypeLits.Normalise\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler\\utils\\Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler\\\\deSugar\\\\DsUsage.hs:179:15 in ghc:DsUsage\r\n}}}\r\n\r\nNo problems with GHC 8.4.3.\r\n\r\n\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15709GHC panic using TypeInType with minimal source code2019-07-07T18:03:20ZjnapeGHC panic using TypeInType with minimal source codeThe following source code causes GHC 8.4.3 on 64bit Linux to panic:
```haskell
{-# LANGUAGE TypeInType #-}
module Lib where
import Data.Kind
class Contravariant f where
contramap :: (a -> b) -> f b -> f a
dimap :: (Contravariant...The following source code causes GHC 8.4.3 on 64bit Linux to panic:
```haskell
{-# LANGUAGE TypeInType #-}
module Lib where
import Data.Kind
class Contravariant f where
contramap :: (a -> b) -> f b -> f a
dimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c
dimap f g = contramap f . fmap g
```
I have no idea if it should compile or not, but it shouldn't do this:
```
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.3 for x86_64-unknown-linux):
piResultTy
k_a34u[tau:1]
*
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:947:35 in ghc:Type
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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 using TypeInType with minimal source code","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":["TypeInType"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following source code causes GHC 8.4.3 on 64bit Linux to panic:\r\n\r\n{{{#!haskell\r\n{-# LANGUAGE TypeInType #-}\r\n\r\nmodule Lib where\r\n\r\nimport Data.Kind\r\n\r\nclass Contravariant f where\r\n contramap :: (a -> b) -> f b -> f a\r\n\r\ndimap :: (Contravariant (p :: * -> b -> p * b), Functor (p a)) => (z -> a) -> (b -> c) -> p a b -> p z c\r\ndimap f g = contramap f . fmap g\r\n}}}\r\n\r\nI have no idea if it should compile or not, but it shouldn't do this:\r\n\r\n{{{\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.3 for x86_64-unknown-linux):\r\n\tpiResultTy\r\n k_a34u[tau:1]\r\n *\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/types/Type.hs:947:35 in ghc:Type\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/15716GHC hangs on default implementation of type family2019-07-07T18:03:19ZHeimdellGHC hangs on default implementation of type familyI have this code:
```
{-# language TypeFamilies #-}
{-# language MultiParamTypeClasses #-}
{-# language FlexibleInstances #-}
import Control.Monad.Except
class Component comp where
data Error comp :: *
type ComponentT comp :: ...I have this code:
```
{-# language TypeFamilies #-}
{-# language MultiParamTypeClasses #-}
{-# language FlexibleInstances #-}
import Control.Monad.Except
class Component comp where
data Error comp :: *
type ComponentT comp :: * -> *
type ComponentT comp = ExceptT (Error comp)
```
I expect it to either compile or fail with error.
Instead, GHC\[i\] hangs every time.
It prints
```
<interactive>:10:28: error:
```
and then hangs.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.4.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":"GHC hangs on default implementation of type family","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":"I have this code:\r\n\r\n{{{\r\n{-# language TypeFamilies #-}\r\n{-# language MultiParamTypeClasses #-}\r\n{-# language FlexibleInstances #-}\r\n\r\nimport Control.Monad.Except\r\n\r\nclass Component comp where\r\n data Error comp :: *\r\n type ComponentT comp :: * -> *\r\n type ComponentT comp = ExceptT (Error comp)\r\n\r\n}}}\r\n\r\nI expect it to either compile or fail with error.\r\n\r\nInstead, GHC[i] hangs every time.\r\n\r\nIt prints\r\n{{{\r\n<interactive>:10:28: error:\r\n}}}\r\n\r\nand then hangs.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/15718Build panic on ghc-8.6.1 under FreeBSD when using -fllvm2022-07-11T05:56:05Zgwright@antiope.comBuild panic on ghc-8.6.1 under FreeBSD when using -fllvmThis looks like a straightforward oversight. I am building my pure haskell LU solver under FreeBSD. I use the -fllvm compiler option because I need extra numerical performance.
When I build, I get (this is the output from GitLab CI, whi...This looks like a straightforward oversight. I am building my pure haskell LU solver under FreeBSD. I use the -fllvm compiler option because I need extra numerical performance.
When I build, I get (this is the output from GitLab CI, which is in turn running 'stack build')
```
Running with gitlab-runner 11.2.0 (35e8515d)
on stacker.18clay.com a2111f63
Using Shell executor...
Running on stacker.18clay.com...
Fetching changes...
Removing .stack-work/
HEAD is now at f8fe3b4 Use llvm60 on FreeBSD.
From https://gitlab.18clay.com/software/luSolve
f8fe3b4..c993a26 streamlined -> origin/streamlined
Checking out c993a262 as streamlined...
Skipping Git submodules setup
$ stack build --pedantic
luSolve-0.5: configure (lib)
Configuring luSolve-0.5...
luSolve-0.5: build (lib)
Preprocessing library for luSolve-0.5..
Building library for luSolve-0.5..
[1 of 1] Compiling Numeric.LinearAlgebra.LUSolve ( src/Numeric/LinearAlgebra/LUSolve.hs, .stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1/build/Numeric/LinearAlgebra/LUSolve.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-portbld-freebsd):
Failed to lookup the datalayout for x86_64-unknown-freebsd; available targets: ["i386-unknown-windows","i686-unknown-windows","x86_64-unknown-windows","arm-unknown-linux-gnueabihf","armv6-unknown-linux-gnueabihf","armv6l-unknown-linux-gnueabihf","armv7-unknown-linux-gnueabihf","armv7a-unknown-linux-gnueabi","armv7l-unknown-linux-gnueabihf","aarch64-unknown-linux-gnu","aarch64-unknown-linux","i386-unknown-linux-gnu","i386-unknown-linux","x86_64-unknown-linux-gnu","x86_64-unknown-linux","armv7-unknown-linux-androideabi","aarch64-unknown-linux-android","powerpc64le-unknown-linux","amd64-portbld-freebsd","arm-unknown-nto-qnx-eabi","i386-apple-darwin","x86_64-apple-darwin","armv7-apple-ios","aarch64-apple-ios","i386-apple-ios","x86_64-apple-ios","aarch64-unknown-freebsd","armv6-unknown-freebsd-gnueabihf","armv7-unknown-freebsd-gnueabihf"]
CallStack (from HasCallStack):
error, called at compiler/llvmGen/LlvmCodeGen.hs:96:24 in ghc:LlvmCodeGen
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
-- While building custom Setup.hs for package luSolve-0.5 using:
/home/gitlab-runner/.stack/setup-exe-cache/x86_64-freebsd/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.1 --builddir=.stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1 build lib:luSolve --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
ERROR: Job failed: exit status 1
```
The bug seems simple. The compiler is looking for the datalayout for x86_64-unknown-freebsd; but what is available is amd64-portbld-freebsd. Is this just a simple naming error? The stack resolver was the cutting-edge nightly-2018-10-6; if it is a problem in their packaging rather than ghc itself I will file a report with them (though ghc did panic here, and as the breath ebbed from its ASTs and light faded from the code generator, it pleaded that a bug report be filed).
I've attached the .cabal file in case it helps.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Build panic on ghc-8.6.1 under FreeBSD when using -fllvm","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This looks like a straightforward oversight. I am building my pure haskell LU solver under FreeBSD. I use the -fllvm compiler option because I need extra numerical performance.\r\n\r\nWhen I build, I get (this is the output from GitLab CI, which is in turn running 'stack build')\r\n\r\n{{{\r\nRunning with gitlab-runner 11.2.0 (35e8515d)\r\n on stacker.18clay.com a2111f63\r\nUsing Shell executor...\r\nRunning on stacker.18clay.com...\r\nFetching changes...\r\nRemoving .stack-work/\r\nHEAD is now at f8fe3b4 Use llvm60 on FreeBSD.\r\nFrom https://gitlab.18clay.com/software/luSolve\r\n f8fe3b4..c993a26 streamlined -> origin/streamlined\r\nChecking out c993a262 as streamlined...\r\nSkipping Git submodules setup\r\n$ stack build --pedantic\r\nluSolve-0.5: configure (lib)\r\nConfiguring luSolve-0.5...\r\nluSolve-0.5: build (lib)\r\nPreprocessing library for luSolve-0.5..\r\nBuilding library for luSolve-0.5..\r\n[1 of 1] Compiling Numeric.LinearAlgebra.LUSolve ( src/Numeric/LinearAlgebra/LUSolve.hs, .stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1/build/Numeric/LinearAlgebra/LUSolve.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-portbld-freebsd):\r\n\tFailed to lookup the datalayout for x86_64-unknown-freebsd; available targets: [\"i386-unknown-windows\",\"i686-unknown-windows\",\"x86_64-unknown-windows\",\"arm-unknown-linux-gnueabihf\",\"armv6-unknown-linux-gnueabihf\",\"armv6l-unknown-linux-gnueabihf\",\"armv7-unknown-linux-gnueabihf\",\"armv7a-unknown-linux-gnueabi\",\"armv7l-unknown-linux-gnueabihf\",\"aarch64-unknown-linux-gnu\",\"aarch64-unknown-linux\",\"i386-unknown-linux-gnu\",\"i386-unknown-linux\",\"x86_64-unknown-linux-gnu\",\"x86_64-unknown-linux\",\"armv7-unknown-linux-androideabi\",\"aarch64-unknown-linux-android\",\"powerpc64le-unknown-linux\",\"amd64-portbld-freebsd\",\"arm-unknown-nto-qnx-eabi\",\"i386-apple-darwin\",\"x86_64-apple-darwin\",\"armv7-apple-ios\",\"aarch64-apple-ios\",\"i386-apple-ios\",\"x86_64-apple-ios\",\"aarch64-unknown-freebsd\",\"armv6-unknown-freebsd-gnueabihf\",\"armv7-unknown-freebsd-gnueabihf\"]\r\nCallStack (from HasCallStack):\r\n error, called at compiler/llvmGen/LlvmCodeGen.hs:96:24 in ghc:LlvmCodeGen\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n\r\n-- While building custom Setup.hs for package luSolve-0.5 using:\r\n /home/gitlab-runner/.stack/setup-exe-cache/x86_64-freebsd/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.1 --builddir=.stack-work/dist/x86_64-freebsd/Cabal-2.4.0.1 build lib:luSolve --ghc-options \" -ddump-hi -ddump-to-file\"\r\n Process exited with code: ExitFailure 1\r\nERROR: Job failed: exit status 1\r\n}}}\r\n\r\nThe bug seems simple. The compiler is looking for the datalayout for x86_64-unknown-freebsd; but what is available is amd64-portbld-freebsd. Is this just a simple naming error? The stack resolver was the cutting-edge nightly-2018-10-6; if it is a problem in their packaging rather than ghc itself I will file a report with them (though ghc did panic here, and as the breath ebbed from its ASTs and light faded from the code generator, it pleaded that a bug report be filed).\r\n\r\nI've attached the .cabal file in case it helps.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15725Core Lint error: Trans coercion mis-match2019-07-07T18:03:14ZRyan ScottCore Lint error: Trans coercion mis-matchI discovered this when debugging #15703. The following code fails to compile with `-dcore-lint`:
```hs
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ...I discovered this when debugging #15703. The following code fails to compile with `-dcore-lint`:
```hs
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Functor.Identity (Identity(..))
import Data.Kind (Type)
import GHC.Exts (Any)
-----
-- The important bits
-----
type instance Meth (x :: Identity a) = GenericMeth x
instance SC Identity
-------------------------------------------------------------------------------
data family Sing :: forall k. k -> Type
data instance Sing :: forall a. Identity a -> Type where
SIdentity :: Sing x -> Sing ('Identity x)
newtype Par1 p = Par1 p
data instance Sing :: forall p. Par1 p -> Type where
SPar1 :: Sing x -> Sing ('Par1 x)
type family Rep1 (f :: Type -> Type) :: Type -> Type
class PGeneric1 (f :: Type -> Type) where
type From1 (z :: f a) :: Rep1 f a
type To1 (z :: Rep1 f a) :: f a
class SGeneric1 (f :: Type -> Type) where
sFrom1 :: forall (a :: Type) (z :: f a). Sing z -> Sing (From1 z)
sTo1 :: forall (a :: Type) (r :: Rep1 f a). Sing r -> Sing (To1 r :: f a)
type instance Rep1 Identity = Par1
instance PGeneric1 Identity where
type From1 ('Identity x) = 'Par1 x
type To1 ('Par1 x) = 'Identity x
instance SGeneric1 Identity where
sFrom1 (SIdentity x) = SPar1 x
sTo1 (SPar1 x) = SIdentity x
type family GenericMeth (x :: f a) :: f a where
GenericMeth x = To1 (Meth (From1 x))
type family Meth (x :: f a) :: f a
class SC f where
sMeth :: forall a (x :: f a).
Sing x -> Sing (Meth x)
default sMeth :: forall a (x :: f a).
( SGeneric1 f, SC (Rep1 f)
, Meth x ~ GenericMeth x
)
=> Sing x -> Sing (Meth x)
sMeth sx = sTo1 (sMeth (sFrom1 sx))
dummy :: f a -> ()
dummy _ = ()
type instance Meth (x :: Par1 p) = x
instance SC Par1 where
sMeth x = x
```
```
$ /opt/ghc/8.6.1/bin/ghc -fforce-recomp Bug.hs -dcore-lint
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Simplifier ***
<no location info>: warning:
[in body of letrec with binders x_s1Nw :: Sing (From1 x_a1Jc)]
Trans coercion mis-match: D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
Rep1 Identity a_a1Jb
Par1 a_a1Jb
Rep1 Identity a_a1Jb
Par1 a_a1Jb
*** Offending Program ***
<elided>
$csMeth_a1J9 [Occ=LoopBreaker]
:: forall a (x :: Identity a). Sing x -> Sing (Meth x)
[LclId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 100 60}]
$csMeth_a1J9
= \ (@ a_a1Jb) (@ (x_a1Jc :: Identity a_a1Jb)) ->
case heq_sel
@ (Identity a_a1Jb)
@ (Identity a_a1Jb)
@ (Meth x_a1Jc)
@ (GenericMeth x_a1Jc)
(($d~_s1Nz @ a_a1Jb @ x_a1Jc)
`cast` (((~)
<Identity a_a1Jb>_N
((To1
<Identity>_N
<a_a1Jb>_N
(Coh (Sym (D:R:MethTYPEPar1px[0]
<a_a1Jb>_N
(Coh (Sym (Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(D:R:Rep1Identity[0] <a_a1Jb>_N))))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Meth
<*>_N
(Sym (D:R:Rep1Identity[0]))
<a_a1Jb>_N
(Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))_N))_N ; (Sym (D:R:GenericMeth[0]
<Identity>_N
<a_a1Jb>_N
<x_a1Jc>_N) ; Sym (D:R:MethTYPEIdentityax[0]
<a_a1Jb>_N
<x_a1Jc>_N)))
((To1
<Identity>_N
<a_a1Jb>_N
(Coh (Sym (Coh (Sym (Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym (D:R:MethTYPEPar1px[0]
<a_a1Jb>_N
(Coh (Sym (Coh <From1
x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))
(D:R:Rep1Identity[0] <a_a1Jb>_N))) ; (Meth
<*>_N
(Sym (D:R:Rep1Identity[0]))
<a_a1Jb>_N
(Coh <From1
x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))_N)))_N ; Sym (D:R:GenericMeth[0]
<Identity>_N
<a_a1Jb>_N
<x_a1Jc>_N)))_R ; N:~[0]
<Identity
a_a1Jb>_N <Meth
x_a1Jc>_N <GenericMeth
x_a1Jc>_N
:: (To1 (From1 x_a1Jc) ~ To1 (From1 x_a1Jc))
~R# (Meth x_a1Jc ~~ GenericMeth x_a1Jc)))
of co_a1Kd
{ __DEFAULT ->
(\ (sx_aEZ :: Sing x_a1Jc) ->
let {
x_s1Nw :: Sing (From1 x_a1Jc)
[LclId]
x_s1Nw = $csFrom1_a1Jz @ a_a1Jb @ x_a1Jc sx_aEZ } in
case x_s1Nw
`cast` ((Sing
(D:R:Rep1Identity[0] <a_a1Jb>_N)
(Coh (Sym (Coh <From1 x_a1Jc>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))_R ; (Nth:3
(Inst (forall (x :: Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N).
(Sing
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
(Sym (Coh <x>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_R
->_R (Sing
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
(Sym (D:R:MethTYPEPar1px[0]
<a_a1Jb>_N
<x>_N) ; (Meth
<*>_N
(Sym (D:R:Rep1Identity[0]))
<a_a1Jb>_N
(Sym (Coh <x>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_N))_R) (Coh <From1
x_a1Jc>_N
(Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))) ; ((Sing
(D:R:Rep1Identity[0] <a_a1Jb>_N))_R ; D:R:SingPar10[0]
<a_a1Jb>_N) (Sym (Coh <Meth
(From1
x_a1Jc)>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N))))
:: Sing (From1 x_a1Jc |> Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)
~R# R:SingPar1
a_a1Jb (Meth (From1 x_a1Jc) |> D:R:Rep1Identity[0] <a_a1Jb>_N))
of
{ SPar1 @ x_a1JZ co_a1K0 x_a195 ->
($WSIdentity @ a_a1Jb @ x_a1JZ x_a195)
`cast` ((Sing
<Identity a_a1Jb>_N
(Sym (D:R:To1IdentityaPar1[0] <a_a1Jb>_N <x_a1JZ>_N) ; (To1
<Identity>_N
<a_a1Jb>_N
(Sym (Coh (Sym (Coh <'Par1
x_a1JZ>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)) ; (Coh <'Par1
x_a1JZ>_N
(Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym co_a1K0 ; Coh <Meth
(From1
x_a1Jc)>_N
(D:R:Rep1Identity[0] <a_a1Jb>_N)))))_N))_R
:: Sing ('Identity x_a1JZ) ~R# Sing (To1 (Meth (From1 x_a1Jc))))
})
`cast` (<Sing x_a1Jc>_R
->_R (Sing
<Identity a_a1Jb>_N
(Sym (D:R:GenericMeth[0]
<Identity>_N <a_a1Jb>_N <x_a1Jc>_N) ; Sym co_a1Kd))_R
:: (Sing x_a1Jc -> Sing (To1 (Meth (From1 x_a1Jc))))
~R# (Sing x_a1Jc -> Sing (Meth x_a1Jc)))
}
end Rec }
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Core Lint error: Trans coercion mis-match","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I discovered this when debugging #15703. The following code fails to compile with `-dcore-lint`:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DefaultSignatures #-}\r\n{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE UndecidableInstances #-}\r\nmodule Bug where\r\n\r\nimport Data.Functor.Identity (Identity(..))\r\nimport Data.Kind (Type)\r\nimport GHC.Exts (Any)\r\n\r\n-----\r\n-- The important bits\r\n-----\r\n\r\ntype instance Meth (x :: Identity a) = GenericMeth x\r\ninstance SC Identity\r\n\r\n-------------------------------------------------------------------------------\r\n\r\ndata family Sing :: forall k. k -> Type\r\ndata instance Sing :: forall a. Identity a -> Type where\r\n SIdentity :: Sing x -> Sing ('Identity x)\r\n\r\nnewtype Par1 p = Par1 p\r\ndata instance Sing :: forall p. Par1 p -> Type where\r\n SPar1 :: Sing x -> Sing ('Par1 x)\r\n\r\ntype family Rep1 (f :: Type -> Type) :: Type -> Type\r\n\r\nclass PGeneric1 (f :: Type -> Type) where\r\n type From1 (z :: f a) :: Rep1 f a\r\n type To1 (z :: Rep1 f a) :: f a\r\n\r\nclass SGeneric1 (f :: Type -> Type) where\r\n sFrom1 :: forall (a :: Type) (z :: f a). Sing z -> Sing (From1 z)\r\n sTo1 :: forall (a :: Type) (r :: Rep1 f a). Sing r -> Sing (To1 r :: f a)\r\n\r\ntype instance Rep1 Identity = Par1\r\n\r\ninstance PGeneric1 Identity where\r\n type From1 ('Identity x) = 'Par1 x\r\n type To1 ('Par1 x) = 'Identity x\r\n\r\ninstance SGeneric1 Identity where\r\n sFrom1 (SIdentity x) = SPar1 x\r\n sTo1 (SPar1 x) = SIdentity x\r\n\r\ntype family GenericMeth (x :: f a) :: f a where\r\n GenericMeth x = To1 (Meth (From1 x))\r\n\r\ntype family Meth (x :: f a) :: f a\r\n\r\nclass SC f where\r\n sMeth :: forall a (x :: f a).\r\n Sing x -> Sing (Meth x)\r\n default sMeth :: forall a (x :: f a).\r\n ( SGeneric1 f, SC (Rep1 f)\r\n , Meth x ~ GenericMeth x\r\n )\r\n => Sing x -> Sing (Meth x)\r\n sMeth sx = sTo1 (sMeth (sFrom1 sx))\r\n\r\n dummy :: f a -> ()\r\n dummy _ = ()\r\n\r\ntype instance Meth (x :: Par1 p) = x\r\ninstance SC Par1 where\r\n sMeth x = x\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc -fforce-recomp Bug.hs -dcore-lint\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\n*** Core Lint errors : in result of Simplifier ***\r\n<no location info>: warning:\r\n [in body of letrec with binders x_s1Nw :: Sing (From1 x_a1Jc)]\r\n Trans coercion mis-match: D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n Rep1 Identity a_a1Jb\r\n Par1 a_a1Jb\r\n Rep1 Identity a_a1Jb\r\n Par1 a_a1Jb\r\n*** Offending Program ***\r\n\r\n<elided>\r\n\r\n$csMeth_a1J9 [Occ=LoopBreaker]\r\n :: forall a (x :: Identity a). Sing x -> Sing (Meth x)\r\n[LclId,\r\n Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,\r\n WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 100 60}]\r\n$csMeth_a1J9\r\n = \\ (@ a_a1Jb) (@ (x_a1Jc :: Identity a_a1Jb)) ->\r\n case heq_sel\r\n @ (Identity a_a1Jb)\r\n @ (Identity a_a1Jb)\r\n @ (Meth x_a1Jc)\r\n @ (GenericMeth x_a1Jc)\r\n (($d~_s1Nz @ a_a1Jb @ x_a1Jc)\r\n `cast` (((~)\r\n <Identity a_a1Jb>_N\r\n ((To1\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n (Coh (Sym (D:R:MethTYPEPar1px[0]\r\n <a_a1Jb>_N\r\n (Coh (Sym (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Meth\r\n <*>_N\r\n (Sym (D:R:Rep1Identity[0]))\r\n <a_a1Jb>_N\r\n (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))_N))_N ; (Sym (D:R:GenericMeth[0]\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n <x_a1Jc>_N) ; Sym (D:R:MethTYPEIdentityax[0]\r\n <a_a1Jb>_N\r\n <x_a1Jc>_N)))\r\n ((To1\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n (Coh (Sym (Coh (Sym (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym (D:R:MethTYPEPar1px[0]\r\n <a_a1Jb>_N\r\n (Coh (Sym (Coh <From1\r\n x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))) ; (Meth\r\n <*>_N\r\n (Sym (D:R:Rep1Identity[0]))\r\n <a_a1Jb>_N\r\n (Coh <From1\r\n x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))_N)))_N ; Sym (D:R:GenericMeth[0]\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n <x_a1Jc>_N)))_R ; N:~[0]\r\n <Identity\r\n a_a1Jb>_N <Meth\r\n x_a1Jc>_N <GenericMeth\r\n x_a1Jc>_N\r\n :: (To1 (From1 x_a1Jc) ~ To1 (From1 x_a1Jc))\r\n ~R# (Meth x_a1Jc ~~ GenericMeth x_a1Jc)))\r\n of co_a1Kd\r\n { __DEFAULT ->\r\n (\\ (sx_aEZ :: Sing x_a1Jc) ->\r\n let {\r\n x_s1Nw :: Sing (From1 x_a1Jc)\r\n [LclId]\r\n x_s1Nw = $csFrom1_a1Jz @ a_a1Jb @ x_a1Jc sx_aEZ } in\r\n case x_s1Nw\r\n `cast` ((Sing\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)\r\n (Coh (Sym (Coh <From1 x_a1Jc>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N ; Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))_R ; (Nth:3\r\n (Inst (forall (x :: Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N).\r\n (Sing\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n (Sym (Coh <x>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_R\r\n ->_R (Sing\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n (Sym (D:R:MethTYPEPar1px[0]\r\n <a_a1Jb>_N\r\n <x>_N) ; (Meth\r\n <*>_N\r\n (Sym (D:R:Rep1Identity[0]))\r\n <a_a1Jb>_N\r\n (Sym (Coh <x>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N))))_N))_R) (Coh <From1\r\n x_a1Jc>_N\r\n (Sym (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))) ; ((Sing\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))_R ; D:R:SingPar10[0]\r\n <a_a1Jb>_N) (Sym (Coh <Meth\r\n (From1\r\n x_a1Jc)>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N))))\r\n :: Sing (From1 x_a1Jc |> Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)\r\n ~R# R:SingPar1\r\n a_a1Jb (Meth (From1 x_a1Jc) |> D:R:Rep1Identity[0] <a_a1Jb>_N))\r\n of\r\n { SPar1 @ x_a1JZ co_a1K0 x_a195 ->\r\n ($WSIdentity @ a_a1Jb @ x_a1JZ x_a195)\r\n `cast` ((Sing\r\n <Identity a_a1Jb>_N\r\n (Sym (D:R:To1IdentityaPar1[0] <a_a1Jb>_N <x_a1JZ>_N) ; (To1\r\n <Identity>_N\r\n <a_a1Jb>_N\r\n (Sym (Coh (Sym (Coh <'Par1\r\n x_a1JZ>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)))\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N)) ; (Coh <'Par1\r\n x_a1JZ>_N\r\n (Sym (D:R:Rep1Identity[0]) <a_a1Jb>_N) ; (Sym co_a1K0 ; Coh <Meth\r\n (From1\r\n x_a1Jc)>_N\r\n (D:R:Rep1Identity[0] <a_a1Jb>_N)))))_N))_R\r\n :: Sing ('Identity x_a1JZ) ~R# Sing (To1 (Meth (From1 x_a1Jc))))\r\n })\r\n `cast` (<Sing x_a1Jc>_R\r\n ->_R (Sing\r\n <Identity a_a1Jb>_N\r\n (Sym (D:R:GenericMeth[0]\r\n <Identity>_N <a_a1Jb>_N <x_a1Jc>_N) ; Sym co_a1Kd))_R\r\n :: (Sing x_a1Jc -> Sing (To1 (Meth (From1 x_a1Jc))))\r\n ~R# (Sing x_a1Jc -> Sing (Meth x_a1Jc)))\r\n }\r\nend Rec }\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://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/15767"StgCmmEnv: variable not found" with FunctionalDependencies and FlexibleContexts2019-07-07T18:03:05Zroland"StgCmmEnv: variable not found" with FunctionalDependencies and FlexibleContexts```
{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}
module Bug where
class C a b | b -> a where f :: a -> b
y = x where
x :: (C () b, C Bool b) => b
x = f ()
```
```
$ ghc -c Bug.hs
ghc: panic! (the 'impossible' happen...```
{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}
module Bug where
class C a b | b -> a where f :: a -> b
y = x where
x :: (C () b, C Bool b) => b
x = f ()
```
```
$ ghc -c Bug.hs
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-openbsd):
StgCmmEnv: variable not found
$dC_a1lC
local binds for:
f
$tc'C:C
$tcC
$trModule
$tc'C:C1_r1mz
$tc'C:C2_r1n0
$krep_r1n1
$krep1_r1n2
$krep2_r1n3
$krep3_r1n4
$krep4_r1n5
$tcC1_r1n6
$tcC2_r1n7
$krep5_r1n8
$krep6_r1n9
$krep7_r1na
$trModule1_r1nb
$trModule2_r1nc
$trModule3_r1nd
$trModule4_r1ne
$krep8_r1nf
$krep9_r1ng
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"\"StgCmmEnv: variable not found\" with FunctionalDependencies and FlexibleContexts","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\n{{{\r\n{-# LANGUAGE FunctionalDependencies, FlexibleContexts #-}\r\n\r\nmodule Bug where\r\n\r\nclass C a b | b -> a where f :: a -> b\r\n\r\ny = x where\r\n x :: (C () b, C Bool b) => b\r\n x = f ()\r\n}}}\r\n\r\n\r\n\r\n{{{\r\n$ ghc -c Bug.hs\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-openbsd):\r\n StgCmmEnv: variable not found\r\n $dC_a1lC\r\n local binds for:\r\n f\r\n $tc'C:C\r\n $tcC\r\n $trModule\r\n $tc'C:C1_r1mz\r\n $tc'C:C2_r1n0\r\n $krep_r1n1\r\n $krep1_r1n2\r\n $krep2_r1n3\r\n $krep3_r1n4\r\n $krep4_r1n5\r\n $tcC1_r1n6\r\n $tcC2_r1n7\r\n $krep5_r1n8\r\n $krep6_r1n9\r\n $krep7_r1na\r\n $trModule1_r1nb\r\n $trModule2_r1nc\r\n $trModule3_r1nd\r\n $trModule4_r1ne\r\n $krep8_r1nf\r\n $krep9_r1ng\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15778GHC HEAD-only panic (zonkTcTyVarToTyVar)2019-07-07T18:03:02ZRyan ScottGHC HEAD-only panic (zonkTcTyVarToTyVar)The following program typechecks on GHC 8.0.1 through 8.6.1:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUA...The following program typechecks on GHC 8.0.1 through 8.6.1:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
module Bug where
import Data.Kind
type a ~> b = a -> b -> Type
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
data family Sing (a :: k)
data Flarble (a :: Type) where
MkFlarble :: Flarble Bool
data instance Sing (z :: Flarble a) where
SMkFlarble :: Sing MkFlarble
elimFlarble :: forall a
(p :: forall x. Flarble x ~> Type)
(f :: Flarble a).
Sing f
-> Apply p MkFlarble
-> Apply p f
elimFlarble s@SMkFlarble pMkFlarble =
case s of
(_ :: Sing (MkFlarble :: Flarble probablyABadIdea)) ->
pMkFlarble
```
However, it panics on GHC HEAD:
```
$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181015 for x86_64-unknown-linux):
zonkTcTyVarToTyVar
probablyABadIdea_aWn[tau:2]
Bool
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcMType.hs:1627:34 in ghc:TcMType
```
If I replace `probablyABadIdea` with `Bool`, then it typechecks again.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | highest |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC HEAD-only panic (zonkTcTyVarToTyVar)","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"8.8.1","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.5","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program typechecks on GHC 8.0.1 through 8.6.1:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE AllowAmbiguousTypes #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeInType #-}\r\n{-# LANGUAGE TypeOperators #-}\r\nmodule Bug where\r\n\r\nimport Data.Kind\r\n\r\ntype a ~> b = a -> b -> Type\r\ntype family Apply (f :: k1 ~> k2) (x :: k1) :: k2\r\ndata family Sing (a :: k)\r\n\r\ndata Flarble (a :: Type) where\r\n MkFlarble :: Flarble Bool\r\ndata instance Sing (z :: Flarble a) where\r\n SMkFlarble :: Sing MkFlarble\r\n\r\nelimFlarble :: forall a\r\n (p :: forall x. Flarble x ~> Type)\r\n (f :: Flarble a).\r\n Sing f\r\n -> Apply p MkFlarble\r\n -> Apply p f\r\nelimFlarble s@SMkFlarble pMkFlarble =\r\n case s of\r\n (_ :: Sing (MkFlarble :: Flarble probablyABadIdea)) ->\r\n pMkFlarble\r\n}}}\r\n\r\nHowever, it panics on GHC HEAD:\r\n\r\n{{{\r\n$ ~/Software/ghc/inplace/bin/ghc-stage2 Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181015 for x86_64-unknown-linux):\r\n zonkTcTyVarToTyVar\r\n probablyABadIdea_aWn[tau:2]\r\n Bool\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/typecheck/TcMType.hs:1627:34 in ghc:TcMType\r\n}}}\r\n\r\nIf I replace `probablyABadIdea` with `Bool`, then it typechecks again.","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15796Core Lint error with invalid newtype declaration2019-07-07T18:02:56ZIcelandjackCore Lint error with invalid newtype declarationThis gives a Core Lint error
```hs
{-# Language QuantifiedConstraints #-}
{-# Language TypeApplications #-}
{-# Language TypeOperators #-}
{-# Language PolyKinds #-}
{-# Language FlexibleInstances #-}
{-# La...This gives a Core Lint error
```hs
{-# Language QuantifiedConstraints #-}
{-# Language TypeApplications #-}
{-# Language TypeOperators #-}
{-# Language PolyKinds #-}
{-# Language FlexibleInstances #-}
{-# Language DataKinds #-}
{-# Language TypeFamilies #-}
{-# Language MultiParamTypeClasses #-}
{-# Language ConstraintKinds #-}
{-# Language UndecidableInstances #-}
{-# Language GADTs #-}
{-# Options_GHC -dcore-lint #-}
import Data.Kind
type Cat ob = ob -> ob -> Type
class Ríki (obj :: Type) where
type (-->) :: Cat obj
class Varpi (f :: dom -> cod)
newtype
(··>) :: Cat (a -> b) where
Natu :: Varpi f
=> (forall xx. f xx --> f' xx)
-> (f ··> f')
instance
Ríki cod
=> -------------
Ríki (dom -> cod)
where
type (-->) = (··>) @dom @cod
```
```
$ ghci -ignore-dot-ghci 568_bug.hs
GHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( 568_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181017 for x86_64-unknown-linux):
Core Lint error
<no location info>: warning:
In the type ‘(··>)’
Found TcTyCon: ··>[tc]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/FamInst.hs:171:31 in ghc:FamInst
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
> :q
Leaving GHCi.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Core Lint error","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This gives a Core Lint error\r\n\r\n{{{#!hs\r\n{-# Language QuantifiedConstraints #-}\r\n{-# Language TypeApplications #-}\r\n{-# Language TypeOperators #-}\r\n{-# Language PolyKinds #-}\r\n{-# Language FlexibleInstances #-}\r\n{-# Language DataKinds #-}\r\n{-# Language TypeFamilies #-}\r\n{-# Language MultiParamTypeClasses #-}\r\n{-# Language ConstraintKinds #-}\r\n{-# Language UndecidableInstances #-}\r\n{-# Language GADTs #-}\r\n\r\n{-# Options_GHC -dcore-lint #-}\r\n\r\nimport Data.Kind\r\n\r\ntype Cat ob = ob -> ob -> Type\r\n\r\nclass Ríki (obj :: Type) where\r\n type (-->) :: Cat obj\r\n\r\nclass Varpi (f :: dom -> cod)\r\n\r\nnewtype\r\n (··>) :: Cat (a -> b) where\r\n Natu :: Varpi f\r\n => (forall xx. f xx --> f' xx)\r\n -> (f ··> f')\r\n\r\ninstance\r\n Ríki cod\r\n => -------------\r\n Ríki (dom -> cod)\r\n where\r\n\r\n type (-->) = (··>) @dom @cod\r\n}}}\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 568_bug.hs\r\nGHCi, version 8.7.20181017: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 568_bug.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181017 for x86_64-unknown-linux):\r\n Core Lint error\r\n <no location info>: warning:\r\n In the type ‘(··>)’\r\n Found TcTyCon: ··>[tc]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/typecheck/FamInst.hs:171:31 in ghc:FamInst\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> :q\r\nLeaving GHCi.\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.6.2https://gitlab.haskell.org/ghc/ghc/-/issues/15808Loading libraries with FFI exports may cause segfaults in the compiler if the...2020-11-14T11:50:27ZAndreas KlebingerLoading libraries with FFI exports may cause segfaults in the compiler if they are loaded far from the rts in memory.Original report below.
In this case we compile aeson which uses TH triggering dynamic loading of a number of libraries.
Some libraries (eg base) have FFI exports which require us to place a relative jump to the RTS in order to register...Original report below.
In this case we compile aeson which uses TH triggering dynamic loading of a number of libraries.
Some libraries (eg base) have FFI exports which require us to place a relative jump to the RTS in order to register a stable name.
Now an issue arises if base is placed more than 2G from the RTS as we can't have relative jumps are limited to a 2GB range.
In the particular case this caused the jump target to underflow, resulting in a jump to unallocated memory and a segfault.
In more detail the PE linker (PEi386.c:ocResolve_PEi386) fails to detect, or properly deal with the bounds violation.
There seems to be some code in place to deal with an overflow already but fails to detect it.
----
I haven't had any luck with reproducing it outside of building the aeson package with cabal yet. So for now just documenting the fact.
build.mk used
```
GhcLibHcOpts += -g3
GhcRtsHcOpts += -g3
STRIP_CMD = :
BUILD_PROF_LIBS = NO
SplitObjs = NO
SplitSections = NO
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
BUILD_MAN = NO
```
Error log:
```
"E:/ghc_dwarf/inplace/bin/ghc-stage2.exe" "--make" "-fbuilding-cabal-package" "-O" "-outputdir" "C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build" "-odir" "C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build" "-hidir" "C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build" "-stubdir" "C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build""-i" "-iC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build" "-i." "-iattoparsec-iso8601/" "-ipure" "-iC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\autogen" "-iC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\global-autogen" "-IC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\autogen" "-IC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\global-autogen" "-IC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build" "-Iinclude" "-IC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\include" "-optP-include" "-optPC:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\autogen\cabal_macros.h" "-this-unit-id" "aeson-1.4.1.0-inplace" "-hide-all-packages" "-Wmissing-home-modules" "-no-user-package-db" "-package-db" "C:\Users\Andi\AppData\Roaming\cabal\store\ghc-8.7.20181025\package.db" "-package-db" "C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\packagedb\ghc-8.7.20181025" "-package-db" "C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\package.conf.inplace" "-package-id" "attoparsec-0.13.2.2-8913a968506e9e83757f6fe696d6fe61e0d4b4a8" "-package-id" "base-4.12.0.0" "-package-id" "base-compat-0.10.5-34e11ceb2d98e0262d1d958bca2afc3184e70c60" "-package-id" "bytestring-0.10.8.2" "-package-id" "containers-0.6.0.1" "-package-id" "deepseq-1.4.4.0" "-package-id" "dlist-0.8.0.5-681a0f929505417757ba9f9981a50ab1d7c8a0e0" "-package-id" "ghc-prim-0.5.3" "-package-id" "hashable-1.2.7.0-50f89c5dee92df34fc2d6540cfde1983f26d8e31" "-package-id" "primitive-0.6.4.0-c08c185073660c1604acdddfe5c369afae583ba2" "-package-id" "scientific-0.3.6.2-4bea197b4523e02da61c34a1eed01432d9fefff6" "-package-id" "tagged-0.8.6-d3cce1acba663b646f565adb64d80579664d8caa" "-package-id" "template-haskell-2.14.0.0" "-package-id" "text-1.2.3.1" "-package-id" "th-abstraction-0.2.8.0-e197ba78a6de8bf8fc5d00ecb5a358a8b27bcc92" "-package-id" "time-1.8.0.2" "-package-id" "time-locale-c_-0.1.1.5-7549537073e62ce01921c89c30cc6cafeed99b5b" "-package-id" "unordered-con_-0.2.9.0-f5cd33176070f516c88b1aac3ef61959b09fcfa6" "-package-id" "uuid-types-1.0.3-f68643250767dce83d2c227104d15a0aa9c3c77f" "-package-id" "vector-0.12.0.1-3a9a26f81a463f0efefa41528af3e27d3a88cc7d" "-XHaskell2010" "Data.Aeson" "Data.Aeson.Encoding" "Data.Aeson.Parser" "Data.Aeson.Text" "Data.Aeson.Types" "Data.Aeson.TH" "Data.Aeson.QQ.Simple" "Data.Aeson.Encoding.Internal" "Data.Aeson.Internal" "Data.Aeson.Internal.Time" "Data.Aeson.Parser.Internal" "Data.Aeson.Encode" "Data.Aeson.Compat" "Data.Aeson.Encoding.Builder" "Data.Aeson.Internal.Functions" "Data.Aeson.Parser.Unescape" "Data.Aeson.Parser.Time" "Data.Aeson.Types.FromJSON" "Data.Aeson.Types.Generic" "Data.Aeson.Types.ToJSON" "Data.Aeson.Types.Class" "Data.Aeson.Types.Internal" "Data.Attoparsec.Time" "Data.Attoparsec.Time.Internal" "Data.Aeson.Parser.UnescapePure" "-Wall" "-O2" "-hide-all-packages" "-g13"
[ 2 of 25] Compiling Data.Aeson.Internal.Functions ( Data\Aeson\Internal\Functions.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Internal\Functions.o ) [Data.HashMap.Strict changed]
[ 5 of 25] Compiling Data.Aeson.Types.Generic ( Data\Aeson\Types\Generic.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Types\Generic.o ) [Prelude.Compat changed]
[ 6 of 25] Compiling Data.Aeson.Types.Internal ( Data\Aeson\Types\Internal.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Types\Internal.o ) [Data.Vector changed]
[ 7 of 25] Compiling Data.Aeson.Parser.Internal ( Data\Aeson\Parser\Internal.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Parser\Internal.o ) [Data.Scientific changed]
[ 8 of 25] Compiling Data.Aeson.Parser ( Data\Aeson\Parser.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Parser.o ) [Data.Aeson.Parser.Internal changed]
[ 9 of 25] Compiling Data.Attoparsec.Time.Internal ( attoparsec-iso8601\Data\Attoparsec\Time\Internal.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Attoparsec\Time\Internal.o ) [Prelude.Compat changed]
attoparsec-iso8601\Data\Attoparsec\Time\Internal.hs:24:1: warning: [-Wunused-imports]
The import of `Unsafe.Coerce' is redundant
except perhaps to import instances from `Unsafe.Coerce'
To import instances alone, use: import Unsafe.Coerce()
|
24 | import Unsafe.Coerce (unsafeCoerce)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[10 of 25] Compiling Data.Attoparsec.Time ( attoparsec-iso8601\Data\Attoparsec\Time.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Attoparsec\Time.o ) [Data.Attoparsec.Text changed]
[11 of 25] Compiling Data.Aeson.Parser.Time ( Data\Aeson\Parser\Time.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Parser\Time.o ) [Data.Attoparsec.Text changed]
[12 of 25] Compiling Data.Aeson.Types.FromJSON ( Data\Aeson\Types\FromJSON.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Types\FromJSON.o ) [Data.Primitive.PrimArray changed]
[13 of 25] Compiling Data.Aeson.Internal ( Data\Aeson\Internal.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Internal.o ) [Data.Aeson.Types.FromJSON changed]
[14 of 25] Compiling Data.Aeson.Internal.Time ( Data\Aeson\Internal\Time.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Internal\Time.o ) [Data.Attoparsec.Time.Internal changed]
[15 of 25] Compiling Data.Aeson.Encoding.Builder ( Data\Aeson\Encoding\Builder.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Encoding\Builder.o ) [Data.Vector changed]
[16 of 25] Compiling Data.Aeson.Encoding.Internal ( Data\Aeson\Encoding\Internal.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Encoding\Internal.o ) [Data.Scientific changed]
[17 of 25] Compiling Data.Aeson.Encoding ( Data\Aeson\Encoding.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Encoding.o ) [Data.Aeson.Encoding.Internal changed]
[18 of 25] Compiling Data.Aeson.Types.ToJSON ( Data\Aeson\Types\ToJSON.hs, C:\ghc\msys64\home\Andi\aeson_repro\dist-newstyle\build\x86_64-windows\ghc-8.7.20181025\aeson-1.4.1.0\build\Data\Aeson\Types\ToJSON.o ) [Data.Primitive.PrimArray changed]
Access violation in generated code when executing data at 0x103fec440
Attempting to reconstruct a stack trace...
Frame Code address
* 0x845d9c0 0x103fec440
* 0x845da20 0x400c0f8 E:\ghc_dwarf\inplace\bin\ghc-stage2.exe+0x3c0c0f8
* 0x845da80 0x3fec9a1 E:\ghc_dwarf\inplace\bin\ghc-stage2.exe+0x3bec9a1
* 0x845dab0 0x3feca31 E:\ghc_dwarf\inplace\bin\ghc-stage2.exe+0x3beca31
* 0x845dab8 0x34c8934 E:\ghc_dwarf\inplace\bin\ghc-stage2.exe+0x30c8934
* 0x845dac0 0xfa340
* 0x845dac8 0x2a940b78
* 0x845dad0 0x2a98cd69
* 0x845dad8 0x2a98d7d0
CallStack (from HasCallStack):
die', called at .\\Distribution\\Client\\ProjectOrchestration.hs:977:55 in main:Distribution.Client.ProjectOrchestration
cabal.exe: Failed to build aeson-1.4.1.0-inplace. The build process terminated
with exit code 11
```
I could only reproduce it with master on Windows so far. It always triggers but under very specific circumstances:
- GHC built with the flags above, adding dwarf info to the ghc executable or removing dwarf info eliminates the issue.
- Only on a complete rebuild of aeson. Restarting the crashed build finishes without an error.Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/15853Unregisterised GHC panics when building test cgrun0182019-07-07T18:02:43ZIlias TsitsimpisUnregisterised GHC panics when building test cgrun018An unregisterised ghc-8.4 on amd64 panics when building test cgrun018.
```
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main ( cgrun018.hs, cgrun018.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC v...An unregisterised ghc-8.4 on amd64 panics when building test cgrun018.
```
Compile failed (exit code 1) errors were:
[1 of 1] Compiling Main ( cgrun018.hs, cgrun018.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.4.4 for x86_64-unknown-linux):
pprStatics: float
F32
F32
F32
F32
F32
F32
F32
F32
F32
F32
F32
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/cmm/PprC.hs:525:5 in ghc:PprC
```
We have seen this error while building packages for Debian on 64-bit architectures where GHC is unregisterised (e.g., mips64el, s390x):
[gloss on mips64el](https://buildd.debian.org/status/fetch.php?pkg=haskell-gloss&arch=mips64el&ver=1.13.0.1-1&stamp=1540810998&raw=0),
[juicypixels on s390x](https://buildd.debian.org/status/fetch.php?pkg=haskell-juicypixels&arch=s390x&ver=3.2.9.5-3&stamp=1540808360&raw=0)
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------------ |
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler (CodeGen) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Unregisterised GHC panics when building test cgrun018","status":"New","operating_system":"","component":"Compiler (CodeGen)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"An unregisterised ghc-8.4 on amd64 panics when building test cgrun018.\r\n\r\n{{{\r\nCompile failed (exit code 1) errors were:\r\n[1 of 1] Compiling Main ( cgrun018.hs, cgrun018.o )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.4.4 for x86_64-unknown-linux):\r\n pprStatics: float\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\r\n F32\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/cmm/PprC.hs:525:5 in ghc:PprC\r\n}}}\r\n\r\nWe have seen this error while building packages for Debian on 64-bit architectures where GHC is unregisterised (e.g., mips64el, s390x):\r\n[https://buildd.debian.org/status/fetch.php?pkg=haskell-gloss&arch=mips64el&ver=1.13.0.1-1&stamp=1540810998&raw=0 gloss on mips64el],\r\n[https://buildd.debian.org/status/fetch.php?pkg=haskell-juicypixels&arch=s390x&ver=3.2.9.5-3&stamp=1540808360&raw=0 juicypixels on s390x]","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/15860Hadrian build fails on FreeBSD2020-03-13T15:12:50ZraichooHadrian build fails on FreeBSDHi,
I've tried a `hadrian/build.sh -j` on my FreeBSD machine and got greeted by a rather nasty looking error.
```
Up to date
shakeArgsWith 0.000s 0%
Function shake 0.275s 80% =========================
Database read 0.000s ...Hi,
I've tried a `hadrian/build.sh -j` on my FreeBSD machine and got greeted by a rather nasty looking error.
```
Up to date
shakeArgsWith 0.000s 0%
Function shake 0.275s 80% =========================
Database read 0.000s 0%
With database 0.000s 0%
Running rules 0.065s 19% =====
Total 0.340s 100%
Error when running Shake build system:
* OracleQ (KeyValue ("hadrian/cfg/system.config","host-os"))
* hadrian/cfg/system.config
* hadrian/cfg/system.config settings mk/config.h compiler/ghc.cabal rts/rts.cabal
Configuration file hadrian/cfg/system.config is missing.
Run the configure script manually or let Hadrian run it automatically by passing the flag --configure.
CallStack (from HasCallStack):
error, called at src/Rules/Configure.hs:25:13 in main:Rules.Configure
```
I've tried this with commit `1a3b9bd0b674ad16a41b942c738b8f34564bcd8d` and my current system is `FreeBSD lain 12.0-BETA3 FreeBSD 12.0-BETA3 r340097 GENERIC amd64`.
Building GHC with the old build system worked perfectly fine though.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------------- |
| Version | 8.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Build System (Hadrian) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Hadrian build fails on FreeBSD","status":"New","operating_system":"","component":"Build System (Hadrian)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.7","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Hi,\r\n\r\nI've tried a `hadrian/build.sh -j` on my FreeBSD machine and got greeted by a rather nasty looking error.\r\n\r\n{{{\r\nUp to date\r\nshakeArgsWith 0.000s 0%\r\nFunction shake 0.275s 80% =========================\r\nDatabase read 0.000s 0%\r\nWith database 0.000s 0%\r\nRunning rules 0.065s 19% =====\r\nTotal 0.340s 100%\r\nError when running Shake build system:\r\n* OracleQ (KeyValue (\"hadrian/cfg/system.config\",\"host-os\"))\r\n* hadrian/cfg/system.config\r\n* hadrian/cfg/system.config settings mk/config.h compiler/ghc.cabal rts/rts.cabal\r\nConfiguration file hadrian/cfg/system.config is missing.\r\nRun the configure script manually or let Hadrian run it automatically by passing the flag --configure.\r\nCallStack (from HasCallStack):\r\n error, called at src/Rules/Configure.hs:25:13 in main:Rules.Configure\r\n}}}\r\n\r\nI've tried this with commit `1a3b9bd0b674ad16a41b942c738b8f34564bcd8d` and my current system is `FreeBSD lain 12.0-BETA3 FreeBSD 12.0-BETA3 r340097 GENERIC amd64`.\r\n\r\nBuilding GHC with the old build system worked perfectly fine though.","type_of_failure":"OtherFailure","blocking":[]} -->Make removalhttps://gitlab.haskell.org/ghc/ghc/-/issues/15862Panic with promoted types that Typeable doesn't support2020-02-25T01:15:47ZRyan ScottPanic with promoted types that Typeable doesn't supportThe following program panics on GHC 8.2 and later:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Bug where
import Type.Reflection
newtype Foo ...The following program panics on GHC 8.2 and later:
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
module Bug where
import Type.Reflection
newtype Foo = MkFoo (forall a. a)
foo :: TypeRep MkFoo
foo = typeRep @MkFoo
```
```
$ /opt/ghc/8.6.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
GHC error in desugarer lookup in Bug:
attempting to use module ‘main:Bug’ (Bug.hs) which is not loaded
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.1 for x86_64-unknown-linux):
initDs
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 8.6.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":"Typeable panic with promoted rank-2 kind (initDs)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.1","keywords":["Typeable"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The following program panics on GHC 8.2 and later:\r\n\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE ImpredicativeTypes #-}\r\n{-# LANGUAGE RankNTypes #-}\r\n{-# LANGUAGE TypeApplications #-}\r\nmodule Bug where\r\n\r\nimport Type.Reflection\r\n\r\nnewtype Foo = MkFoo (forall a. a)\r\n\r\nfoo :: TypeRep MkFoo\r\nfoo = typeRep @MkFoo\r\n}}}\r\n{{{\r\n$ /opt/ghc/8.6.1/bin/ghc Bug.hs\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nGHC error in desugarer lookup in Bug:\r\n attempting to use module ‘main:Bug’ (Bug.hs) which is not loaded\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.6.1 for x86_64-unknown-linux):\r\n initDs\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/15870No skolem info panic2019-07-07T18:02:38Zsheafsam.derbyshire@gmail.comNo skolem info panicI've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:
```
bug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-mingw3...I've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:
```
bug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-mingw32):
No skolem info:
[k_a1Hgj]
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
```
Here's a boiled down version (with a bit of extraneous code left in for context, as it's so short):
```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
data Optic a where
--Index :: Nat -> Optic a
--Name :: Symbol -> Optic a
(:.:) :: Optic a -> Optic b -> Optic a -- composition
class Gettable a (optic :: Optic a) where
type Get a (optic :: Optic a)
{-
some basic instances, e.g.
instance Gettable (a,b) (Index 0) where
type Get (a,b) (Index 0) = a
...
-}
instance forall a b (g1 :: Optic a) (g2 :: Optic b).
( Gettable a g1
, b ~ Get a g1
, Gettable b g2
) => Gettable a (g1 :.: g2) where
type Get a (g1 :.: g2) = Get a g2
```
The program I am actually trying to write has the instance declaration changed to
```hs
instance forall a b (g1 :: Optic a) (g2 :: Optic (Get a g1)).
( Gettable a g1
, b ~ Get a g1
, Gettable b g2
) => Gettable a (g1 :.: g2) where
type Get a (g1 :.: g2) = Get (Get a g1) g2
```
but GHC complains that it can't match kinds:
```
• Expected kind ‘Optic b’, but ‘g2’ has kind ‘Optic (Get a g1)’
• In the second argument of ‘Gettable’, namely ‘g2’
In the instance declaration for ‘Gettable a (g1 :.: g2)’
|
20 | , Gettable b g2
|
```
I don't know if there is a way around that, and I'd be interested to hear any advice.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ----------------------- |
| Version | 8.6.2 |
| Type | Bug |
| 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":"No skolem info panic","status":"New","operating_system":"","component":"Compiler (Type checker)","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I've been toying with some type-level lenses and running into some issues with kind unification, when I ran into a panic:\r\n\r\n\r\n{{{\r\nbug.hs:30:34: error:ghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 8.6.2 for x86_64-unknown-mingw32):\r\n No skolem info:\r\n [k_a1Hgj]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler\\utils\\Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler\\\\typecheck\\\\TcErrors.hs:2891:5 in ghc:TcErrors\r\n}}}\r\n\r\nHere's a boiled down version (with a bit of extraneous code left in for context, as it's so short):\r\n{{{#!hs\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE FlexibleInstances #-}\r\n{-# LANGUAGE GADTs #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\n{-# LANGUAGE PolyKinds #-}\r\n{-# LANGUAGE ScopedTypeVariables #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n\r\ndata Optic a where\r\n --Index :: Nat -> Optic a\r\n --Name :: Symbol -> Optic a\r\n (:.:) :: Optic a -> Optic b -> Optic a -- composition\r\n\r\nclass Gettable a (optic :: Optic a) where\r\n type Get a (optic :: Optic a)\r\n\r\n{-\r\nsome basic instances, e.g.\r\ninstance Gettable (a,b) (Index 0) where\r\n type Get (a,b) (Index 0) = a\r\n...\r\n-}\r\n\r\ninstance forall a b (g1 :: Optic a) (g2 :: Optic b).\r\n ( Gettable a g1\r\n , b ~ Get a g1\r\n , Gettable b g2\r\n ) => Gettable a (g1 :.: g2) where\r\n type Get a (g1 :.: g2) = Get a g2\r\n}}}\r\n\r\nThe program I am actually trying to write has the instance declaration changed to\r\n{{{#!hs\r\ninstance forall a b (g1 :: Optic a) (g2 :: Optic (Get a g1)).\r\n ( Gettable a g1\r\n , b ~ Get a g1\r\n , Gettable b g2\r\n ) => Gettable a (g1 :.: g2) where\r\n type Get a (g1 :.: g2) = Get (Get a g1) g2\r\n}}}\r\nbut GHC complains that it can't match kinds:\r\n\r\n{{{\r\n • Expected kind ‘Optic b’, but ‘g2’ has kind ‘Optic (Get a g1)’\r\n • In the second argument of ‘Gettable’, namely ‘g2’\r\n In the instance declaration for ‘Gettable a (g1 :.: g2)’\r\n |\r\n20 | , Gettable b g2\r\n |\r\n}}}\r\nI don't know if there is a way around that, and I'd be interested to hear any advice.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://gitlab.haskell.org/ghc/ghc/-/issues/15883GHC panic: newtype F rep = F (forall (a :: TYPE rep). a)2020-01-17T16:43:24ZIcelandjackGHC panic: newtype F rep = F (forall (a :: TYPE rep). a)```hs
{-# Language RankNTypes #-}
{-# Language KindSignatures #-}
{-# Language PolyKinds #-}
import GHC.Exts
newtype Foo rep = MkFoo (forall (a :: TYPE rep). a)
```
```
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interact...```hs
{-# Language RankNTypes #-}
{-# Language KindSignatures #-}
{-# Language PolyKinds #-}
import GHC.Exts
newtype Foo rep = MkFoo (forall (a :: TYPE rep). a)
```
```
$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci /tmp/U.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( /tmp/U.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.7.20181029 for x86_64-unknown-linux):
isUnliftedType
forall (a :: TYPE rep_a1AA[sk:0]). a :: TYPE rep_a1AA[sk:0]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:2332:10 in ghc:Type
isUnliftedType, called at compiler/typecheck/TcTyClsDecls.hs:3055:25 in ghc:TcTyClsDecls
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
```
<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":"GHC panic: newtype F rep = F (forall (a :: TYPE rep). a)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"{{{#!hs\r\n{-# Language RankNTypes #-}\r\n{-# Language KindSignatures #-}\r\n{-# Language PolyKinds #-}\r\n\r\nimport GHC.Exts\r\n\r\nnewtype Foo rep = MkFoo (forall (a :: TYPE rep). a)\r\n}}}\r\n\r\n{{{\r\n$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci /tmp/U.hs\r\nGHCi, version 8.7.20181029: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( /tmp/U.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.7.20181029 for x86_64-unknown-linux):\r\n isUnliftedType\r\n forall (a :: TYPE rep_a1AA[sk:0]). a :: TYPE rep_a1AA[sk:0]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/types/Type.hs:2332:10 in ghc:Type\r\n isUnliftedType, called at compiler/typecheck/TcTyClsDecls.hs:3055:25 in ghc:TcTyClsDecls\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/15914haddock-library-1.7.0 fails to build on ppc64 BE2019-07-27T14:54:23ZJens Petersenhaddock-library-1.7.0 fails to build on ppc64 BEI was trying to build ghc-8.6.2 for Fedora 28 and it failed on ppc64 (Bigendian) with:
```
utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs:99:25: error:
• GHC internal error: ‘TableRow’ is not in scope during type c...I was trying to build ghc-8.6.2 for Fedora 28 and it failed on ppc64 (Bigendian) with:
```
utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs:99:25: error:
• GHC internal error: ‘TableRow’ is not in scope during type checking, but it passed the renamer
tcl_env of environment: [aIy :-> Type variable ‘id’ = id :: k,
rHO :-> ATcTyCon Table :: k -> *,
rHP :-> APromotionErr RecDataConPE]
• In the type ‘[TableRow id]’
In the definition of data constructor ‘Table’
In the data declaration for ‘Table’
|
99 | { tableHeaderRows :: [TableRow id]
| ^^^^^^^^
utils/haddock/dist/build/haddock/autogen/Paths_haddock.hs:41:22: error:
• Couldn't match type ‘a’ with ‘String’
Expected type: IO a
Actual type: IO String
• In the first argument of ‘catchIO’, namely
‘(getEnv "haddock_libdir")’
In the expression:
catchIO (getEnv "haddock_libdir") (\ _ -> return libdir)
In an equation for ‘getLibDir’:
getLibDir
= catchIO (getEnv "haddock_libdir") (\ _ -> return libdir)
|
41 | getLibDir = catchIO (getEnv "haddock_libdir") (\_ -> return libdir)
| ^^^^^^^^^^^^^^^^^^^^^^^
make[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Documentation/Haddock/Types.dyn_o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Paths_haddock.dyn_o] Error 1
utils/haddock/haddock-api/src/Haddock/Syb.hs:22:1: warning: [-Wunused-top-binds]
Defined but not used: ‘isType’
|
22 | isType _ = isJust $ eqT @a @b
| ^^^^^^
utils/haddock/haddock-api/src/Haddock/Syb.hs:38:1: warning: [-Wunused-top-binds]
Defined but not used: ‘everythingBut’
|
38 | everythingBut k f x = let (v, stop) = f x
| ^^^^^^^^^^^^^
utils/haddock/haddock-api/src/Haddock/Syb.hs:60:21: warning: [-Wunused-matches]
Defined but not used: ‘s’
|
60 | everythingWithState s k f x =
| ^
utils/haddock/haddock-api/src/Haddock/Syb.hs:75:1: warning: [-Wunused-top-binds]
Defined but not used: ‘everywhereBut’
|
75 | everywhereBut q f x
| ^^^^^^^^^^^^^
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.6.2 for powerpc64-unknown-linux):
urk! lookup local fingerprint
$fShowTokenType
[]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/iface/MkIface.hs:524:37 in ghc:MkIface
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
make[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Haddock/Backends/Hyperlinker/Types.dyn_o] Error 1
make: *** [Makefile:127: all] Error 2
```
https://koji.fedoraproject.org/koji/taskinfo?taskID=30919315 (the log files are only preserved for 2 weeks)
<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":"haddock-library-1.7.0 fails to build on ppc64 BE","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"8.6.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.6.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I was trying to build ghc-8.6.2 for Fedora 28 and it failed on ppc64 (Bigendian) with:\r\n\r\n{{{\r\nutils/haddock/haddock-library/src/Documentation/Haddock/Types.hs:99:25: error:\r\n • GHC internal error: ‘TableRow’ is not in scope during type checking, but it passed the renamer\r\n tcl_env of environment: [aIy :-> Type variable ‘id’ = id :: k,\r\n rHO :-> ATcTyCon Table :: k -> *,\r\n rHP :-> APromotionErr RecDataConPE]\r\n • In the type ‘[TableRow id]’\r\n In the definition of data constructor ‘Table’\r\n In the data declaration for ‘Table’\r\n |\r\n99 | { tableHeaderRows :: [TableRow id]\r\n | ^^^^^^^^\r\nutils/haddock/dist/build/haddock/autogen/Paths_haddock.hs:41:22: error:\r\n • Couldn't match type ‘a’ with ‘String’\r\n Expected type: IO a\r\n Actual type: IO String\r\n • In the first argument of ‘catchIO’, namely\r\n ‘(getEnv \"haddock_libdir\")’\r\n In the expression:\r\n catchIO (getEnv \"haddock_libdir\") (\\ _ -> return libdir)\r\n In an equation for ‘getLibDir’:\r\n getLibDir\r\n = catchIO (getEnv \"haddock_libdir\") (\\ _ -> return libdir)\r\n |\r\n41 | getLibDir = catchIO (getEnv \"haddock_libdir\") (\\_ -> return libdir)\r\n | ^^^^^^^^^^^^^^^^^^^^^^^\r\nmake[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Documentation/Haddock/Types.dyn_o] Error 1\r\nmake[1]: *** Waiting for unfinished jobs....\r\nmake[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Paths_haddock.dyn_o] Error 1\r\nutils/haddock/haddock-api/src/Haddock/Syb.hs:22:1: warning: [-Wunused-top-binds]\r\n Defined but not used: ‘isType’\r\n |\r\n22 | isType _ = isJust $ eqT @a @b\r\n | ^^^^^^\r\nutils/haddock/haddock-api/src/Haddock/Syb.hs:38:1: warning: [-Wunused-top-binds]\r\n Defined but not used: ‘everythingBut’\r\n |\r\n38 | everythingBut k f x = let (v, stop) = f x\r\n | ^^^^^^^^^^^^^\r\nutils/haddock/haddock-api/src/Haddock/Syb.hs:60:21: warning: [-Wunused-matches]\r\n Defined but not used: ‘s’\r\n |\r\n60 | everythingWithState s k f x =\r\n | ^\r\nutils/haddock/haddock-api/src/Haddock/Syb.hs:75:1: warning: [-Wunused-top-binds]\r\n Defined but not used: ‘everywhereBut’\r\n |\r\n75 | everywhereBut q f x\r\n | ^^^^^^^^^^^^^\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.6.2 for powerpc64-unknown-linux):\r\n\turk! lookup local fingerprint\r\n $fShowTokenType\r\n []\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable\r\n pprPanic, called at compiler/iface/MkIface.hs:524:37 in ghc:MkIface\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\nmake[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/build/Haddock/Backends/Hyperlinker/Types.dyn_o] Error 1\r\nmake: *** [Makefile:127: all] Error 2\r\n}}}\r\n\r\nhttps://koji.fedoraproject.org/koji/taskinfo?taskID=30919315 (the log files are only preserved for 2 weeks)","type_of_failure":"OtherFailure","blocking":[]} -->8.6.3https://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/15970Recompilation bug with default class methods2019-07-07T18:02:13ZSimon MarlowRecompilation bug with default class methodsRepro as follows.
A.hs:
```hs
{-# OPTIONS_GHC -fno-full-laziness #-}
module A (toTypedData, toTypedDataNoDef) where
toTypedData :: String -> IO Int
toTypedData s = wrapPrint "yoyo" $ toTypedDataNoDef s
wrapPrint :: String -> IO Int -...Repro as follows.
A.hs:
```hs
{-# OPTIONS_GHC -fno-full-laziness #-}
module A (toTypedData, toTypedDataNoDef) where
toTypedData :: String -> IO Int
toTypedData s = wrapPrint "yoyo" $ toTypedDataNoDef s
wrapPrint :: String -> IO Int -> IO Int
wrapPrint s act = do
putStrLn s
act
toTypedDataNoDef :: String -> IO Int
toTypedDataNoDef s = return $ length s
```
B.hs:
```hs
module B ( TypeClass(..) ) where
import A
class Show a => TypeClass a where
getSize :: a -> IO Int
getSize a = toTypedData (show a)
printA :: a -> IO ()
```
C.hs:
```hs
module Main where
import B
data MyDataType = MyDataType String Int deriving Show
instance TypeClass MyDataType where
printA = putStrLn . show
main :: IO ()
main = do
let myValue = MyDataType "haha" 99
sz <- getSize myValue
putStrLn $ show sz
printA myValue
```
1. Comment out the `-fno-full-laziness` option in A.hs
1. `rm *.o *.hi; ghc -O2 C.hs`
1. Re-enable the `-fno-full-laziness` option in A.hs
1. `ghc -O2 C.hs`
Produces a linker error:
```
C.o:Main_main1_info: error: undefined reference to 'A_toTypedData2_closure'
C.o(.data.rel.ro+0x48): error: undefined reference to 'A_toTypedData2_closure'
collect2: error: ld returned 1 exit status
```
Reproduced in 8.0, 8.4 and master. Probably happens in all released versions of GHC.8.6.4Simon MarlowSimon Marlowhttps://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/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/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/16057GHC 8.6.3 byte-code interpreter segfaults on any object.2019-07-07T18:01:41Zgizmo.mk0GHC 8.6.3 byte-code interpreter segfaults on any object.Have these two files in a directory:
Main.hs:
```hs
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Helper
main = return ()
test
```
Helper.hs:
```hs
{-# LANGUAGE TemplateHaskell #-}
module Helper where
import Language.Ha...Have these two files in a directory:
Main.hs:
```hs
{-# LANGUAGE TemplateHaskell #-}
module Main where
import Helper
main = return ()
test
```
Helper.hs:
```hs
{-# LANGUAGE TemplateHaskell #-}
module Helper where
import Language.Haskell.TH
test :: Q [Dec]
test = return []
```
If compiled with `ghc Main.hs`, the compilation freezes, when it reaches `Main`.
This compiles without problems on Linux (Ubuntu 18) using GHC 8.6.3, and there is no problem in GHC 8.4.3 on either Windows or Linux.
GCC version: 8.2.0 Rev3 (from MSYS2) / 7.2.0 Rev1 (from cmd.exe)
Adding -dcore-lint does not change the outcome.8.6.4https://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/16079runTestTT from ghci caused a panic.2019-07-07T18:01:36ZemacsthevikingrunTestTT from ghci caused a panic.Inside a REPL within Emacs+Intero-mode, running a stack project. I am writing a simple lexer for fun and I decided to try to see why I wasn't getting expected behaviour from an HUnit function.
I have attached the tar-balled stack projec...Inside a REPL within Emacs+Intero-mode, running a stack project. I am writing a simple lexer for fun and I decided to try to see why I wasn't getting expected behaviour from an HUnit function.
I have attached the tar-balled stack project for completeness, apologies for the size but I didn't want to risk omiotting anything important to you guys if this ever gets looked at in the melee!
```
runTestTT classificationTests
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.4 for x86_64-unknown-linux):
nameModule
system $dShow_a5Xw
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/basicTypes/Name.hs:241:3 in ghc:Name
```
<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":"runTestTT from ghci caused a panic.","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":"Inside a REPL within Emacs+Intero-mode, running a stack project. I am writing a simple lexer for fun and I decided to try to see why I wasn't getting expected behaviour from an HUnit function.\r\n\r\nI have attached the tar-balled stack project for completeness, apologies for the size but I didn't want to risk omiotting anything important to you guys if this ever gets looked at in the melee!\r\n\r\n{{{\r\n runTestTT classificationTests\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.4 for x86_64-unknown-linux):\r\n\tnameModule\r\n system $dShow_a5Xw\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/basicTypes/Name.hs:241:3 in ghc:Name\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/16080runTestTT from ghci caused a panic.2019-07-07T18:01:36ZemacsthevikingrunTestTT from ghci caused a panic.Inside a REPL within Emacs+Intero-mode, running a stack project. I am writing a simple lexer for fun and I decided to try to see why I wasn't getting expected behaviour from an HUnit function.
```
runTestTT classificationTests
ghc: pan...Inside a REPL within Emacs+Intero-mode, running a stack project. I am writing a simple lexer for fun and I decided to try to see why I wasn't getting expected behaviour from an HUnit function.
```
runTestTT classificationTests
ghc: panic! (the 'impossible' happened)
(GHC version 8.4.4 for x86_64-unknown-linux):
nameModule
system $dShow_a5Xw
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
pprPanic, called at compiler/basicTypes/Name.hs:241:3 in ghc:Name
```
<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":"runTestTT from ghci caused a panic.","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":"Inside a REPL within Emacs+Intero-mode, running a stack project. I am writing a simple lexer for fun and I decided to try to see why I wasn't getting expected behaviour from an HUnit function.\r\n\r\n\r\n{{{\r\n runTestTT classificationTests\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 8.4.4 for x86_64-unknown-linux):\r\n\tnameModule\r\n system $dShow_a5Xw\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/basicTypes/Name.hs:241:3 in ghc:Name\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->