GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:41:31Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/9175Bad interaction between Pattern Synonyms and Text2019-07-07T18:41:31ZemertensBad interaction between Pattern Synonyms and TextCompiling this file causes the impossible to happen. It is necessary to enable optimizations. The bug did not occur if the Text parameter was replaced with ByteString or String.
```
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE Overload...Compiling this file causes the impossible to happen. It is necessary to enable optimizations. The bug did not occur if the Text parameter was replaced with ByteString or String.
```
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE OverloadedStrings #-}
module Bug where
{-
- Must compile with optimizations
-
- text-1.1.1.3
- ghc-7.8.2
- Both Darwin and Linux platforms
-
-}
import Data.Text(Text)
data T = C Text Bool
f :: a -> b
f _ = undefined
{-# NOINLINE f #-} -- important
pattern P1 a = C "sh" a -- at least two characters
pattern P2 = C "x" True -- this pattern has to come last
g :: Text -> T
g x = case x of
"" -> f (P1 undefined) -- this has to be a pattern synonym
```
```
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.2 for x86_64-apple-darwin):
StgCmmEnv: variable not found
lvl_s2Jr{v} [lid]
local binds for:
main:Bug.f{v rBS} [gid]
main:Bug.rewriteRule{v rBV} [gid]
main:Bug.$mP2{v r17q} [gid]
main:Bug.$WP2{v r17A} [gid]
main:Bug.$mP1{v r17E} [gid]
main:Bug.$WP1{v r17R} [gid]
main:Bug.$WP3{v r3bq} [gid]
main:Bug.$WP4{v r3ua} [gid]
main:Bug.$WP5{v r3ub} [gid]
main:Bug.$WP2_dt{v r3uc} [gid]
main:Bug.$WP6{v r3ud} [gid]
main:Bug.$WP7{v r3ue} [gid]
main:Bug.$WP8{v r3uf} [gid]
main:Bug.$w$mP1{v r3ug} [gid]
main:Bug.$w$mP2{v r3uh} [gid]
main:Bug.$mP3{v r3ui} [gid]
main:Bug.$mP4{v r3uj} [gid]
main:Bug.$mP5{v r3uk} [gid]
main:Bug.$wrewriteRule{v r3ul} [gid]
main:Bug.rewriteRule1{v r3um} [gid]
main:Bug.rewriteRule2{v r3un} [gid]
main:Bug.rewriteRule3{v r3uo} [gid]
main:Bug.rewriteRule4{v r3up} [gid]
main:Bug.rewriteRule5{v r3uq} [gid]
lvl{v r3ur} [gid]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------------------------------- |
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | bos@serpentine.com, diatchki@gmail.com |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Bad interaction between Pattern Synonyms and Text","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["bos@serpentine.com","diatchki@gmail.com"],"type":"Bug","description":"Compiling this file causes the impossible to happen. It is necessary to enable optimizations. The bug did not occur if the Text parameter was replaced with ByteString or String.\r\n\r\n{{{\r\n{-# LANGUAGE PatternSynonyms #-}\r\n{-# LANGUAGE OverloadedStrings #-}\r\nmodule Bug where\r\n\r\n{-\r\n - Must compile with optimizations\r\n -\r\n - text-1.1.1.3\r\n - ghc-7.8.2\r\n - Both Darwin and Linux platforms\r\n -\r\n -}\r\n\r\nimport Data.Text(Text)\r\n\r\ndata T = C Text Bool\r\n\r\nf :: a -> b\r\nf _ = undefined\r\n{-# NOINLINE f #-} -- important\r\n\r\npattern P1 a = C \"sh\" a -- at least two characters\r\npattern P2 = C \"x\" True -- this pattern has to come last\r\n\r\ng :: Text -> T\r\ng x = case x of\r\n \"\" -> f (P1 undefined) -- this has to be a pattern synonym\r\n}}}\r\n\r\n{{{\r\n[1 of 1] Compiling Bug ( Bug.hs, Bug.o )\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 7.8.2 for x86_64-apple-darwin):\r\n\tStgCmmEnv: variable not found\r\n lvl_s2Jr{v} [lid]\r\n local binds for:\r\n main:Bug.f{v rBS} [gid]\r\n main:Bug.rewriteRule{v rBV} [gid]\r\n main:Bug.$mP2{v r17q} [gid]\r\n main:Bug.$WP2{v r17A} [gid]\r\n main:Bug.$mP1{v r17E} [gid]\r\n main:Bug.$WP1{v r17R} [gid]\r\n main:Bug.$WP3{v r3bq} [gid]\r\n main:Bug.$WP4{v r3ua} [gid]\r\n main:Bug.$WP5{v r3ub} [gid]\r\n main:Bug.$WP2_dt{v r3uc} [gid]\r\n main:Bug.$WP6{v r3ud} [gid]\r\n main:Bug.$WP7{v r3ue} [gid]\r\n main:Bug.$WP8{v r3uf} [gid]\r\n main:Bug.$w$mP1{v r3ug} [gid]\r\n main:Bug.$w$mP2{v r3uh} [gid]\r\n main:Bug.$mP3{v r3ui} [gid]\r\n main:Bug.$mP4{v r3uj} [gid]\r\n main:Bug.$mP5{v r3uk} [gid]\r\n main:Bug.$wrewriteRule{v r3ul} [gid]\r\n main:Bug.rewriteRule1{v r3um} [gid]\r\n main:Bug.rewriteRule2{v r3un} [gid]\r\n main:Bug.rewriteRule3{v r3uo} [gid]\r\n main:Bug.rewriteRule4{v r3up} [gid]\r\n main:Bug.rewriteRule5{v r3uq} [gid]\r\n lvl{v r3ur} [gid]\r\n\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/9160Panic: Template variable unbound in rewrite rule2019-07-07T18:41:36ZMiëtek BakPanic: Template variable unbound in rewrite ruleInstalling `singletons-1.0` with GHC 7.8.2 on both OS X 10.9.2 and Ubuntu 2014.04 fails:
```
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.2 for x86_64-apple-darwin):
Template variable unbound in rewrite rule
```
T...Installing `singletons-1.0` with GHC 7.8.2 on both OS X 10.9.2 and Ubuntu 2014.04 fails:
```
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.2 for x86_64-apple-darwin):
Template variable unbound in rewrite rule
```
This seems to be an issue with the optimizer, as the bug only appears with optimization level 2, using the following line in `~/.cabal/config`:
```
optimization: 2
```
See also [goldfirere/singletons\#83](https://github.com/goldfirere/singletons/issues/83)7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/9106GHC Panic related to functional dependencies - kindFunResult2019-07-07T18:41:53ZyuriyGHC Panic related to functional dependencies - kindFunResultMinimal example:
```
{-# LANGUAGE
MultiParamTypeClasses, DataKinds, FunctionalDependencies, TypeOperators,
KindSignatures, PolyKinds, FlexibleInstances, FlexibleContexts, UndecidableInstances #-}
import GHC.TypeLits
data Proxy (...Minimal example:
```
{-# LANGUAGE
MultiParamTypeClasses, DataKinds, FunctionalDependencies, TypeOperators,
KindSignatures, PolyKinds, FlexibleInstances, FlexibleContexts, UndecidableInstances #-}
import GHC.TypeLits
data Proxy (a :: k) = Proxy
class FunctorN n f a fa | n f a -> fa where
fmapn :: Proxy n -> Proxy f -> (a -> a) -> fa -> fa
instance FunctorN 0 f a a where
fmapn _ _ a = a
instance (Functor f, FunctorN (n - 1) f a fa) => FunctorN n f a (f fa) where
fmapn _ pf f = fmap (fmapn (Proxy :: Proxy (n-1)) pf f)
```
Crashes with ghc and ghci:
```
>ghc test
[1 of 1] Compiling Main ( test.hs, test.o )
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.8.20140130 for x86_64-unknown-mingw32):
kindFunResult k{tv azb} [sk]
>ghci test
GHCi, version 7.8.20140130: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( test.hs, interpreted )
ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.8.20140130 for x86_64-unknown-mingw32):
kindFunResult k{tv aPm} [sk]
```
Removing the functional dependency makes the code compile.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.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 related to functional dependencies - kindFunResult","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Minimal example:\r\n\r\n{{{\r\n{-# LANGUAGE \r\n MultiParamTypeClasses, DataKinds, FunctionalDependencies, TypeOperators,\r\n KindSignatures, PolyKinds, FlexibleInstances, FlexibleContexts, UndecidableInstances #-}\r\n\r\nimport GHC.TypeLits \r\n\r\ndata Proxy (a :: k) = Proxy \r\n\r\nclass FunctorN n f a fa | n f a -> fa where \r\n fmapn :: Proxy n -> Proxy f -> (a -> a) -> fa -> fa\r\n\r\ninstance FunctorN 0 f a a where \r\n fmapn _ _ a = a \r\n\r\ninstance (Functor f, FunctorN (n - 1) f a fa) => FunctorN n f a (f fa) where \r\n fmapn _ pf f = fmap (fmapn (Proxy :: Proxy (n-1)) pf f)\r\n}}}\r\n\r\nCrashes with ghc and ghci:\r\n\r\n{{{\r\n>ghc test\r\n[1 of 1] Compiling Main ( test.hs, test.o )\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 7.8.20140130 for x86_64-unknown-mingw32):\r\n kindFunResult k{tv azb} [sk]\r\n\r\n>ghci test\r\nGHCi, version 7.8.20140130: http://www.haskell.org/ghc/ :? for help\r\nLoading package ghc-prim ... linking ... done.\r\nLoading package integer-gmp ... linking ... done.\r\nLoading package base ... linking ... done.\r\n[1 of 1] Compiling Main ( test.hs, interpreted )\r\nghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 7.8.20140130 for x86_64-unknown-mingw32):\r\n kindFunResult k{tv aPm} [sk]\r\n}}}\r\n\r\nRemoving the functional dependency makes the code compile. ","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/9080GHC error on Win 8.1 64bit2019-07-07T18:42:01ZmaunGHC error on Win 8.1 64bitHi, i get the following error when building GHCJS:
```
Loading package conduit-1.1.1 ... linking ... done.
Loading package yaml-0.8.8.2 ... ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.8.2 for x86_64-unknown-mingw32):
...Hi, i get the following error when building GHCJS:
```
Loading package conduit-1.1.1 ... linking ... done.
Loading package yaml-0.8.8.2 ... ghc.exe: panic! (the 'impossible' happened)
(GHC version 7.8.2 for x86_64-unknown-mingw32):
loadObj "C:\\Users\\Manuel\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-
7.8.2\\yaml-0.8.8.2\\HSyaml-0.8.8.2.o": failed
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
ghc.exe: Unknown PEi386 section name `.text.unlikely' (while processing: C:\User
s\Manuel\AppData\Roaming\cabal\x86_64-windows-ghc-7.8.2\yaml-0.8.8.2\HSyaml-0.8.
8.2.o)
cabal: Error: some packages failed to install:
ghcjs-0.1.0 failed during the building phase. The exception was:
ExitFailure 1
```
Also reported this for ghcjs (https://github.com/ghcjs/ghcjs/issues/170)
I am not using the haskell plattform, but the 7.8.2 binaries + MinGW and MSYS. I also tried mingw-w64 but this made no difference. I am also using the recent ghcjs cabal branch.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.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 error on Win 8.1 64bit","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"7.8.3","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Hi, i get the following error when building GHCJS:\r\n\r\n{{{\r\nLoading package conduit-1.1.1 ... linking ... done.\r\nLoading package yaml-0.8.8.2 ... ghc.exe: panic! (the 'impossible' happened)\r\n (GHC version 7.8.2 for x86_64-unknown-mingw32):\r\n loadObj \"C:\\\\Users\\\\Manuel\\\\AppData\\\\Roaming\\\\cabal\\\\x86_64-windows-ghc-\r\n7.8.2\\\\yaml-0.8.8.2\\\\HSyaml-0.8.8.2.o\": failed\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\nghc.exe: Unknown PEi386 section name `.text.unlikely' (while processing: C:\\User\r\ns\\Manuel\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-7.8.2\\yaml-0.8.8.2\\HSyaml-0.8.\r\n8.2.o)\r\ncabal: Error: some packages failed to install:\r\nghcjs-0.1.0 failed during the building phase. The exception was:\r\nExitFailure 1\r\n}}}\r\n\r\nAlso reported this for ghcjs (https://github.com/ghcjs/ghcjs/issues/170)\r\n\r\nI am not using the haskell plattform, but the 7.8.2 binaries + MinGW and MSYS. I also tried mingw-w64 but this made no difference. I am also using the recent ghcjs cabal branch.","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/9071Panic with -XDeriveFunctor when deriving from a non-Functor in a separate module2019-07-07T18:42:03ZbensPanic with -XDeriveFunctor when deriving from a non-Functor in a separate module## Mu in the same file
*src/Main.hs*
```
{-# LANGUAGE DeriveFunctor #-}
module Main where
newtype Mu f = Mu (f (Mu f))
newtype K a b = K a
newtype F a = F (Mu (K a)) deriving Functor
main :: IO ()
main = return ()
```
----
```
$ c...## Mu in the same file
*src/Main.hs*
```
{-# LANGUAGE DeriveFunctor #-}
module Main where
newtype Mu f = Mu (f (Mu f))
newtype K a b = K a
newtype F a = F (Mu (K a)) deriving Functor
main :: IO ()
main = return ()
```
----
```
$ cabal build
Building panic-0.1.0.0...
Preprocessing executable 'panic' for panic-0.1.0.0...
[1 of 1] Compiling Main ( src/Main.hs, dist/build/panic/panic-tmp/Main.o )
src/Main.hs:7:37:
No instance for (Functor Mu)
arising from the first field of ‘F’ (type ‘Mu (K a)’)
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Functor F)
```
## Mu in a separate file
*src/Mu.hs*
```
module Mu where
newtype Mu f = Mu (f (Mu f))
```
*src/Main.hs*
```
{-# LANGUAGE DeriveFunctor #-}
module Main where
import Mu
newtype K a b = K a
newtype F a = F (Mu (K a)) deriving Functor
main :: IO ()
main = return ()
```
----
```
$ cabal build
Building panic-0.1.0.0...
Preprocessing executable 'panic' for panic-0.1.0.0...
[1 of 2] Compiling Mu ( src/Mu.hs, dist/build/panic/panic-tmp/Mu.o )
[2 of 2] Compiling Main ( src/Main.hs, dist/build/panic/panic-tmp/Main.o )
src/Main.hs:8:37:ghc: panic! (the 'impossible' happened)
(GHC version 7.8.2 for x86_64-unknown-linux):
Prelude.(!!): index too large
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.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 -XDeriveFunctor when deriving from a non-Functor in a separate module","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"== Mu in the same file ==\r\n\r\n''src/Main.hs''\r\n\r\n{{{\r\n{-# LANGUAGE DeriveFunctor #-}\r\n\r\nmodule Main where\r\n\r\nnewtype Mu f = Mu (f (Mu f))\r\nnewtype K a b = K a\r\nnewtype F a = F (Mu (K a)) deriving Functor\r\n\r\nmain :: IO ()\r\nmain = return ()\r\n}}}\r\n\r\n----\r\n\r\n{{{\r\n$ cabal build\r\nBuilding panic-0.1.0.0...\r\nPreprocessing executable 'panic' for panic-0.1.0.0...\r\n[1 of 1] Compiling Main ( src/Main.hs, dist/build/panic/panic-tmp/Main.o )\r\n\r\nsrc/Main.hs:7:37:\r\n No instance for (Functor Mu)\r\n arising from the first field of ‘F’ (type ‘Mu (K a)’)\r\n Possible fix:\r\n use a standalone 'deriving instance' declaration,\r\n so you can specify the instance context yourself\r\n When deriving the instance for (Functor F)\r\n}}}\r\n\r\n\r\n== Mu in a separate file ==\r\n\r\n''src/Mu.hs''\r\n{{{\r\nmodule Mu where\r\n\r\nnewtype Mu f = Mu (f (Mu f))\r\n}}}\r\n\r\n''src/Main.hs''\r\n{{{\r\n{-# LANGUAGE DeriveFunctor #-}\r\n\r\nmodule Main where\r\n\r\nimport Mu\r\n\r\nnewtype K a b = K a\r\nnewtype F a = F (Mu (K a)) deriving Functor\r\n\r\nmain :: IO ()\r\nmain = return ()\r\n}}}\r\n\r\n----\r\n\r\n{{{\r\n$ cabal build\r\nBuilding panic-0.1.0.0...\r\nPreprocessing executable 'panic' for panic-0.1.0.0...\r\n[1 of 2] Compiling Mu ( src/Mu.hs, dist/build/panic/panic-tmp/Mu.o )\r\n[2 of 2] Compiling Main ( src/Main.hs, dist/build/panic/panic-tmp/Main.o )\r\n\r\nsrc/Main.hs:8:37:ghc: panic! (the 'impossible' happened)\r\n (GHC version 7.8.2 for x86_64-unknown-linux):\r\n\tPrelude.(!!): index too large\r\n\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/9050Panic when compiling cmm file together with -outputdir2019-07-07T18:42:08ZYurasPanic when compiling cmm file together with -outputdirTo reproduce:
```
$ touch test.cmm
$ ghc -c test.cmm -outputdir=build
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 7.9.20140428 for x86_64-unknown-linux):
hscCmmFile: no_mod
```
The panic is declared in `main/HscMain....To reproduce:
```
$ touch test.cmm
$ ghc -c test.cmm -outputdir=build
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 7.9.20140428 for x86_64-unknown-linux):
hscCmmFile: no_mod
```
The panic is declared in `main/HscMain.hs:hscCompileCmmFile` in place of current module name, but forced in `main/CodeOutput.lhs:outputForeignStubs` by `doesFileExist`.
It works without `-outputdir` because in that case module name is not used to create path to stub file, see `main/Finder.lhs:mkStubPaths`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.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 when compiling cmm file together with -outputdir","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"\r\nTo reproduce:\r\n\r\n{{{\r\n$ touch test.cmm\r\n$ ghc -c test.cmm -outputdir=build\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 7.9.20140428 for x86_64-unknown-linux):\r\n\thscCmmFile: no_mod\r\n}}}\r\n\r\nThe panic is declared in `main/HscMain.hs:hscCompileCmmFile` in place of current module name, but forced in `main/CodeOutput.lhs:outputForeignStubs` by `doesFileExist`.\r\n\r\nIt works without `-outputdir` because in that case module name is not used to create path to stub file, see `main/Finder.lhs:mkStubPaths`.\r\n","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/8932Panic with TemplateHaskell and duplicate indentifiers2019-07-07T18:42:45ZJan Stolarekjan.stolarek@ed.ac.ukPanic with TemplateHaskell and duplicate indentifiersThis code causes GHC panic under 7.8.1-RC2:
```
{-# LANGUAGE TemplateHaskell #-}
module TXXXX where
$([d|
foo :: a -> a
foo x = x
|])
foo :: a
foo = undefined
```
```
[killy@xerxes : /dane/projekty/sandbox/haskell] ghc -fforce-...This code causes GHC panic under 7.8.1-RC2:
```
{-# LANGUAGE TemplateHaskell #-}
module TXXXX where
$([d|
foo :: a -> a
foo x = x
|])
foo :: a
foo = undefined
```
```
[killy@xerxes : /dane/projekty/sandbox/haskell] ghc -fforce-recomp TXXXX.hs
[1 of 1] Compiling TXXXX ( TXXXX.hs, TXXXX.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.4.0 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
ghc: panic! (the 'impossible' happened)
(GHC version 7.8.0.20140226 for x86_64-unknown-linux):
lookupExactOcc
foo_a2kL{v}
[main:TXXXX.foo{v a2kL} defined at TXXXX.hs:11:1,
main:TXXXX.foo{v a2kL} defined at TXXXX.hs:5:3]
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.8.1-rc2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Panic with TemplateHaskell and duplicate indentifiers","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"This code causes GHC panic under 7.8.1-RC2:\r\n\r\n{{{\r\n{-# LANGUAGE TemplateHaskell #-}\r\n\r\nmodule TXXXX where\r\n\r\n$([d|\r\n foo :: a -> a\r\n foo x = x\r\n |])\r\n\r\nfoo :: a\r\nfoo = undefined\r\n}}}\r\n\r\n{{{\r\n[killy@xerxes : /dane/projekty/sandbox/haskell] ghc -fforce-recomp TXXXX.hs\r\n[1 of 1] Compiling TXXXX ( TXXXX.hs, TXXXX.o )\r\nLoading package ghc-prim ... linking ... done.\r\nLoading package integer-gmp ... linking ... done.\r\nLoading package base ... linking ... done.\r\nLoading package array-0.5.0.0 ... linking ... done.\r\nLoading package deepseq-1.3.0.2 ... linking ... done.\r\nLoading package containers-0.5.4.0 ... linking ... done.\r\nLoading package pretty-1.1.1.1 ... linking ... done.\r\nLoading package template-haskell ... linking ... done.\r\nghc: panic! (the 'impossible' happened)\r\n (GHC version 7.8.0.20140226 for x86_64-unknown-linux):\r\n lookupExactOcc\r\n foo_a2kL{v}\r\n [main:TXXXX.foo{v a2kL} defined at TXXXX.hs:11:1,\r\n main:TXXXX.foo{v a2kL} defined at TXXXX.hs:5:3]\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/8768Internal compiler error on haskell-src-exts 1.14.01 (profiling)2019-07-07T18:43:34ZMagnusTherningInternal compiler error on haskell-src-exts 1.14.01 (profiling)I'm configuring and building `haskell-src-exts` like this:
```
runhaskell Setup configure -O -p --enable-shared \
-fbase4
runhaskell Setup build
```
It builds the ordinary bits just fine, but when it gets to compiling for prof...I'm configuring and building `haskell-src-exts` like this:
```
runhaskell Setup configure -O -p --enable-shared \
-fbase4
runhaskell Setup build
```
It builds the ordinary bits just fine, but when it gets to compiling for profiling:
```
[ 1 of 22] Compiling Language.Haskell.Exts.Annotated.Syntax ( src/Language/Haskell/Exts/Annotated/Syntax.hs, dist/build/Language/Haskell/Exts/Annotated/Syntax.p_o )
/tmp/ghc340_0/ghc340_8.s:1:0:
internal compiler error: Segmentation fault
.section .rodata
^
Please submit a full bug report,
with preprocessed source if appropriate.
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.8.1-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":"Internal compiler error on haskell-src-exts 1.14.01 (profiling)","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.8.1-rc1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"I'm configuring and building {{{haskell-src-exts}}} like this:\r\n\r\n{{{\r\nrunhaskell Setup configure -O -p --enable-shared \\\r\n -fbase4\r\nrunhaskell Setup build\r\n}}}\r\n\r\nIt builds the ordinary bits just fine, but when it gets to compiling for profiling:\r\n\r\n{{{\r\n[ 1 of 22] Compiling Language.Haskell.Exts.Annotated.Syntax ( src/Language/Haskell/Exts/Annotated/Syntax.hs, dist/build/Language/Haskell/Exts/Annotated/Syntax.p_o )\r\n\r\n/tmp/ghc340_0/ghc340_8.s:1:0:\r\n internal compiler error: Segmentation fault\r\n .section .rodata\r\n ^\r\nPlease submit a full bug report,\r\nwith preprocessed source if appropriate.\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3https://gitlab.haskell.org/ghc/ghc/-/issues/8641ghc with -odir and -prof (or any stub file) does not create the specified out...2019-07-07T18:44:07Zwmarshallghc with -odir and -prof (or any stub file) does not create the specified output directoryCalling ghc with -odir set to a non-existent directory causes ghc to create the directory. However, if the -prof option is also specified, ghc fails to create the directory and quits with an error.
Steps to reproduce:
```
$ echo 'main ...Calling ghc with -odir set to a non-existent directory causes ghc to create the directory. However, if the -prof option is also specified, ghc fails to create the directory and quits with an error.
Steps to reproduce:
```
$ echo 'main = print "Hello world"' > Main.hs
$ ghc Main.hs -odir bin
[1 of 1] Compiling Main ( Main.hs, bin\Main.o )
Linking Main.exe ...
$ rm -Rvf bin
removed `bin/Main.o'
removed directory: `bin'
$ ghc Main.hs -odir bin -prof
[1 of 1] Compiling Main ( Main.hs, bin\Main.o )
C:/Program Files (x86)/Haskell Platform/2013.2.0.0/mingw/bin/ld.exe: cannot open output file bin\Main.o: No such file or directory
collect2: ld returned 1 exit status
```
Expected result: The output directory is created regardless of whether -prof is specified.
The above commands were executed from within Cygwin, but the error occurs in the Windows command shell as well. (I used Cygwin here because it is easier to give precise instructions to reproduce the error.)
I have only tested this on Windows. I do not know if the issue exists on Linux or other platforms.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.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 with -odir and -prof cannot create the specified output directory","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.6.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Calling ghc with -odir set to a non-existent directory causes ghc to create the directory. However, if the -prof option is also specified, ghc fails to create the directory and quits with an error.\r\n\r\nSteps to reproduce:\r\n{{{\r\n$ echo 'main = print \"Hello world\"' > Main.hs\r\n\r\n$ ghc Main.hs -odir bin\r\n[1 of 1] Compiling Main ( Main.hs, bin\\Main.o )\r\nLinking Main.exe ...\r\n\r\n$ rm -Rvf bin\r\nremoved `bin/Main.o'\r\nremoved directory: `bin'\r\n\r\n$ ghc Main.hs -odir bin -prof\r\n[1 of 1] Compiling Main ( Main.hs, bin\\Main.o )\r\nC:/Program Files (x86)/Haskell Platform/2013.2.0.0/mingw/bin/ld.exe: cannot open output file bin\\Main.o: No such file or directory\r\ncollect2: ld returned 1 exit status\r\n}}}\r\n\r\nExpected result: The output directory is created regardless of whether -prof is specified.\r\n\r\nThe above commands were executed from within Cygwin, but the error occurs in the Windows command shell as well. (I used Cygwin here because it is easier to give precise instructions to reproduce the error.)\r\n\r\nI have only tested this on Windows. I do not know if the issue exists on Linux or other platforms.","type_of_failure":"OtherFailure","blocking":[]} -->7.8.3Edward Z. YangEdward Z. Yang