GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2019-07-07T18:14:52Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/14965GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation;...2019-07-07T18:14:52ZblynnGHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint failsA simple program that works in 8.2.1 fails in 8.4.1 when compiled with -O. (Sorry, haven't tested 8.2.2.) GHC with -dcore-lint reports an error.
See attached files. In one file I declared:
```hs
module Sep where
data Sep = Sep
{ bug...A simple program that works in 8.2.1 fails in 8.4.1 when compiled with -O. (Sorry, haven't tested 8.2.2.) GHC with -dcore-lint reports an error.
See attached files. In one file I declared:
```hs
module Sep where
data Sep = Sep
{ bugVanishesWithoutThis :: [()]
, middle :: [String]
, orThis :: [()]
}
catSep :: Sep -> Sep -> Sep
catSep (Sep a b c) (Sep x y z) = Sep (a ++ x) (b ++ y) (c ++ z)
cc :: Sep -> Bool
cc boost = elem "foo" $ middle boost
```
and in a second file, simple code fails when compiled with -O:
```hs
module Main (main) where
import Sep
main :: IO ()
main = print $ cc bb
bb :: Sep
bb = catSep b1 b2
b1 :: Sep
b1 = Sep [] ["foo"] []
b2 :: Sep
b2 = Sep [] ["bar"] []
```
This should print "True", and does so for GHC 8.2.1, and GHC 8.4.1 without -O, but prints "False" for GHC 8.4.1 with -O.
I was unable to reproduce the bug with a single file.
<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 | ben@dfinity.org |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["ben@dfinity.org"],"type":"Bug","description":"A simple program that works in 8.2.1 fails in 8.4.1 when compiled with -O. (Sorry, haven't tested 8.2.2.) GHC with -dcore-lint reports an error.\r\n\r\nSee attached files. In one file I declared:\r\n\r\n{{{#!hs\r\nmodule Sep where\r\n\r\ndata Sep = Sep\r\n { bugVanishesWithoutThis :: [()]\r\n , middle :: [String]\r\n , orThis :: [()]\r\n }\r\n\r\ncatSep :: Sep -> Sep -> Sep\r\ncatSep (Sep a b c) (Sep x y z) = Sep (a ++ x) (b ++ y) (c ++ z)\r\n\r\ncc :: Sep -> Bool\r\ncc boost = elem \"foo\" $ middle boost\r\n}}}\r\n\r\nand in a second file, simple code fails when compiled with -O:\r\n\r\n{{{#!hs\r\nmodule Main (main) where\r\n\r\nimport Sep\r\n\r\nmain :: IO ()\r\nmain = print $ cc bb\r\n\r\nbb :: Sep\r\nbb = catSep b1 b2\r\n\r\nb1 :: Sep\r\nb1 = Sep [] [\"foo\"] []\r\n\r\nb2 :: Sep\r\nb2 = Sep [] [\"bar\"] []\r\n}}}\r\n\r\nThis should print \"True\", and does so for GHC 8.2.1, and GHC 8.4.1 without -O, but prints \"False\" for GHC 8.4.1 with -O.\r\n\r\nI was unable to reproduce the bug with a single file.","type_of_failure":"OtherFailure","blocking":[]} -->8.4.2https://gitlab.haskell.org/ghc/ghc/-/issues/14894HEAD fails to build with -g12022-10-25T14:14:38ZniteriaHEAD fails to build with -g1I wanted to see how `-g1` vs `-g2` impact compile speed. Unfortunately I get linking errors trying to build GHC with `-g1`.
Steps:
1. Add:
```
GhcLibHcOpts += -g1
GhcRtsHcOpts += -g1
```
to `mk/build.mk`. I used devel2 flavor.
1. `....I wanted to see how `-g1` vs `-g2` impact compile speed. Unfortunately I get linking errors trying to build GHC with `-g1`.
Steps:
1. Add:
```
GhcLibHcOpts += -g1
GhcRtsHcOpts += -g1
```
to `mk/build.mk`. I used devel2 flavor.
1. `./boot && ./configure && make -j`
1. Observe failure
The failure (trimmed):
```
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1c94): error: undefined refe
rence to '.LcbG2_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1cc7): error: undefined refe
rence to '.LcbGL_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1cfa): error: undefined refe
rence to '.LcbI0_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x1d2d): error: undefined refe
rence to '.LcbIh_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x21a4): error: undefined refe
rence to '.LcbSn_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x21d1): error: undefined refe
rence to '.LcbTc_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x234f): error: undefined refe
rence to '.Lcc18_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2c76): error: undefined refe
rence to '.Lccmj_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2dff): error: undefined refe
rence to '.LccsV_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2e2f): error: undefined refe
rence to '.Lcct6_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2f38): error: undefined refe
rence to '.Lccv1_info_die'
/data/users/bnitka/ghc-HEAD-dwarf-lint-fixes-g/libraries/base/dist-install/build/libHSbase-4.11.0.0.a(Internals.o)(.debug_info+0x2f66): error: undefined refe
rence to '.Lccve_die'
```8.4.2https://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.2