GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2022-04-25T16:43:06Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/21319HEAD fails to compile futhark-0.21.8 after "Kill derived constraints" patch2022-04-25T16:43:06ZRyan ScottHEAD fails to compile futhark-0.21.8 after "Kill derived constraints" patchAfter commit a599abba, GHC HEAD is no longer able to compile the `futhark-0.21.8` library on Hackage. Here is a minimized example of the problem:
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
ty...After commit a599abba, GHC HEAD is no longer able to compile the `futhark-0.21.8` library on Hackage. Here is a minimized example of the problem:
```hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
type family F x
f :: (F a ~ Maybe a, Show (F a)) => a -> IO ()
f _ = pure ()
g :: (F a ~ Maybe a, Show (F a)) => a -> IO ()
g = go
where
go = f
```
While GHC 9.2 and earlier are able to compile this, HEAD rejects it with:
```
$ ~/Software/ghc-9.3.20220328/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o ) [Source file changed]
Bug.hs:13:10: error:
• Could not deduce (Show a) arising from a use of ‘f’
from the context: (F a ~ Maybe a, Show (F a))
bound by the type signature for:
g :: forall a. (F a ~ Maybe a, Show (F a)) => a -> IO ()
at Bug.hs:10:1-46
Possible fix:
add (Show a) to the context of
the type signature for:
g :: forall a. (F a ~ Maybe a, Show (F a)) => a -> IO ()
• In the expression: f
In an equation for ‘go’: go = f
In an equation for ‘g’:
g = go
where
go = f
|
13 | go = f
| ^
```
The release notes entries in a599abba didn't appear to mention this kind of program behavior changing, so I thought it best to file a GHC issue about this. @rae, should this be expected to work?9.4.1Richard Eisenbergrae@richarde.devsheafsam.derbyshire@gmail.comRichard Eisenbergrae@richarde.devhttps://gitlab.haskell.org/ghc/ghc/-/issues/21265winery-1.3.2 panics on HEAD (expectJust isRecDataCon:go_tc_app)2022-03-26T17:38:23ZRyan Scottwinery-1.3.2 panics on HEAD (expectJust isRecDataCon:go_tc_app)_(Originally discovered in a `head.hackage` build [here](https://gitlab.haskell.org/RyanGlScott/head.hackage/-/jobs/983508#L4976).)_
The `winery-1.3.2` library on Hackage panics when compiled with GHC HEAD at commit bb779b90bb093274ccf7..._(Originally discovered in a `head.hackage` build [here](https://gitlab.haskell.org/RyanGlScott/head.hackage/-/jobs/983508#L4976).)_
The `winery-1.3.2` library on Hackage panics when compiled with GHC HEAD at commit bb779b90bb093274ccf7a8e5b19f6661f4925bde. Here is a minimized example:
```hs
{-# LANGUAGE RankNTypes #-}
module Codec.Winery.Class (extractorProduct') where
class GSerialiseProduct f where
dummy :: f x -> ()
productExtractor :: TransFusion [] ((->) Bool) (f Int)
extractorProduct' :: GSerialiseProduct f => Maybe (f Int)
extractorProduct' = unTransFusion productExtractor go
go :: f x -> Maybe (g x)
go _ = Nothing
newtype TransFusion f g a = TransFusion { unTransFusion :: forall h. Applicative h => (forall x. f x -> h (g x)) -> h a }
```
```
$ ~/Software/ghc-9.3.20220316/bin/ghc Bug.hs -O -fforce-recomp
[1 of 1] Compiling Codec.Winery.Class ( Bug.hs, Bug.o )
<no location info>: error:
expectJust isRecDataCon:go_tc_app
CallStack (from HasCallStack):
error, called at compiler/GHC/Data/Maybe.hs:71:27 in ghc:GHC.Data.Maybe
expectJust, called at compiler/GHC/Core/Opt/WorkWrap/Utils.hs:1348:25 in ghc:GHC.Core.Opt.WorkWrap.Utils
```
This regression was introduced in commit 8ff32124c8cd37050f3dc7cbb32b8d41711ebcaf (`DmdAnal: Don't unbox recursive data types`). cc @sgraf8129.4.1Sebastian GrafSebastian Grafhttps://gitlab.haskell.org/ghc/ghc/-/issues/21251Compact regions with sharing can lose pointer tags.2022-03-20T03:26:06ZAndreas KlebingerCompact regions with sharing can lose pointer tags.This caused https://gitlab.haskell.org/ghc/ghc/-/issues/21189
This issue is as follows. We create a compact region with some values.
We add a constructor with strict fields, where the fields reference values *already* in the compact re...This caused https://gitlab.haskell.org/ghc/ghc/-/issues/21189
This issue is as follows. We create a compact region with some values.
We add a constructor with strict fields, where the fields reference values *already* in the compact region.
This (eventually) results in a call to `stg_compactAddWorkerzh` in order to compact the closures the constructor fields point to, with this particular snippet being executed.
```
// Everything else we should copy and evaluate the components:
case
CONSTR,
CONSTR_1_0,
CONSTR_2_0,
CONSTR_1_1: {
(should) = ccall shouldCompact(compact "ptr", p "ptr");
if (should == SHOULDCOMPACT_IN_CNF) { P_[pp] = p; return(); }
```
pp is the address to store the result in. `p` is the *untagged* pointer. The fix is simple. Use `tag | p` instead of `p` (as this code already does in other places!).
I will put up a patch shortly.
This caused https://gitlab.haskell.org/ghc/ghc/-/issues/211899.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/21229Inlining DFuns leads to an unsound interaction with Specialise2023-09-13T12:07:03ZSebastian GrafInlining DFuns leads to an unsound interaction with Specialise!7599 unveiled a bug in the Specialiser.
* See also #21328
* Test is in `simplCore/should_run/T21229`
Back to the Specialiser. Consider
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE AllowA...!7599 unveiled a bug in the Specialiser.
* See also #21328
* Test is in `simplCore/should_run/T21229`
Back to the Specialiser. Consider
```hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
data B = T | F deriving Show
class Sing (b :: B) where sing :: B
instance Sing 'T where sing = T
instance Sing 'F where sing = F
f :: forall a. Sing a => Int -> (Int -> B -> B) -> B
f 0 g = g 0 (sing @a)
f n g = f @a (n-1) g
h :: forall a. Sing a => Int -> (Int -> B -> B) -> B
h = case sing @a of
T -> f @'T
F -> f @a
{-# NOINLINE h #-}
main = print $ h @'T 0 (\ _ a -> a)
```
With -O0, this prints `T`, as expected, because `h` will ultimately call its supplied argument once with `T`.
But with -O, I get `F`. Why is that? The reason is we ultimately get the following specialisation for the second call to `f`:
```
RULES: "SPEC f @a"
forall (@(a_aXu :: B)) ($dSing_s1OW :: Sing a_aXu).
f @a_aXu $dSing_s1OW
= $sf_s1OX @a_aXu]
```
and this specialisation (for when `$dSing_s1OW` is `F`) somehow also applies at `f @'T`.
FTR, here is the output of the `pprTrace "spec_call"` in Specialise:
```
spec_call
call info: CI{SpecType a_aXu
SpecDict F `cast` (Sym (N:Sing[0] <a_aXu>_N) :: B ~R# Sing a_aXu)}
useful: True
rule_bndrs: [a_aXu, $dSing_s1OW]
lhs_args: [TYPE: a_aXu, $dSing_s1OW]
spec_bndrs: [a_aXu]
spec_args: [TYPE: a_aXu,
F `cast` (Sym (N:Sing[0] <a_aXu>_N) :: B ~R# Sing a_aXu)]
dx_binds: []
rhs_env2: <InScope = {main g_aC8 a_aXu $cshowsPrec_aY5 $cshow_aYd
$cshowList_aYl $krep_aZ1 $krep_aZ2 $krep_aZ3 $krep_aZ4 $krep_aZ5
$krep_aZ6 ds_dZX main $fShowB $fSingF F $fSingT $tc'C:Sing
$trModule $tc'F $tc'T $tcB $tcSing f h main_s19F main_s19G
main_s1OF $trModule_s1OG $trModule_s1OH $trModule_s1OI
$trModule_s1OJ $krep_s1OK $tcB_s1OL $tcB_s1OM $tc'T_s1ON $tc'T_s1OO
$tc'F_s1OP $tc'F_s1OQ $tcSing_s1OR $tcSing_s1OS $krep_s1OT
$tc'C:Sing_s1OU $tc'C:Sing_s1OV}
IdSubst = [aKV :-> F
`cast` (Sym (N:Sing[0] <a_aXu>_N) :: B ~R# Sing a_aXu)]
TvSubst = [aKU :-> a_aXu]
CvSubst = []>
[]
```
How did it come to this?! For that we have to look at the Core of `h` that Specialise sees:
```
h = \ (@(a_aWY :: B))
($dSing_aWZ :: Sing a_aWY)
(eta_B0 :: Int)
(eta_B1 :: Int -> B -> B) ->
case $dSing_aWZ
`cast` (Main.N:Sing[0] <a_aWY>_N :: Sing a_aWY ~R# B)
of {
T ->
f @'T
(Main.T `cast` (Sym (Main.N:Sing[0] <'T>_N) :: B ~R# Sing 'T))
eta_B0
eta_B1;
F ->
f @a_aWY
(Main.F
`cast` (Sym (Main.N:Sing[0] <a_aWY>_N) :: B ~R# Sing a_aWY))
eta_B0
eta_B1
}
```
Note the second call to `f`. The type argument `a_aWY` is passed, as well as `Main.F` as the dictionary. That's strange! We should know *statically* that `a_aWY` must be `F`. (In fact, ``Main.F `cast` (Sym (Main.N:Sing[0] <a_aWY>_N) :: B ~R# Sing a_aWY)`` is unsound if `a_aWY` is instantiated to `T`, which would perhaps happen if we floated that expression out of the `F` case. I guess it doesn't matter much, at least not to this ticket.)
How did we get this code? After desugaring, we still have
```
h = \ (@(a_aXu :: B)) ($dSing_aXv :: Sing a_aXu) ->
case sing @a_aXu $dSing_aXv of {
T -> f @'T Main.$fSingT;
F -> f @a_aXu $dSing_aXv
}
```
But then gentle simplification inlines `sing` and sees that `$dSing_aXv` is `F` in the `F` case, performs a binder swap and successively inlines `F` (at least that's what I believe the Simplifier does).
Then the Specialiser can't connect `F` to the arguments `$dSing_aXv` or the type arg `a` and somehow bogs up. I suspect this happens in `specHeader`, but actually I'm not completely sure.
I couldn't reproduce with GHC 9.2 and any prior release. I see that we get the same Core pre-Specialise, but it is handled soundly there and we only get a specialisation for `T`. So perhaps we want to fix this before 9.4.9.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/21219Network issues with zw3rk linux runners lead to jobs taking 3x as long as before2022-03-11T12:39:30ZMatthew PickeringNetwork issues with zw3rk linux runners lead to jobs taking 3x as long as beforeA recent change seems to have made the download speed on the zw3rk runner fleet very slow so it takes nearly 2 hours to download and build the hadrian dependencies. This makes normal validate builds take upwards of 2 hours, which greatly...A recent change seems to have made the download speed on the zw3rk runner fleet very slow so it takes nearly 2 hours to download and build the hadrian dependencies. This makes normal validate builds take upwards of 2 hours, which greatly lengthens the CI pipeline time.Moritz AngermannMoritz Angermannhttps://gitlab.haskell.org/ghc/ghc/-/issues/21189Agda fails to install on HEAD2022-03-19T20:50:18ZRyan ScottAgda fails to install on HEAD_(Continuing a discussion at ghc/head.hackage!210.)_
Currently, `Agda` fails to install properly when built with GHC HEAD using `head.hackage` patches. The error arises when trying to run `Agda`'s custom `Setup.hs` script during the cop..._(Continuing a discussion at ghc/head.hackage!210.)_
Currently, `Agda` fails to install properly when built with GHC HEAD using `head.hackage` patches. The error arises when trying to run `Agda`'s custom `Setup.hs` script during the copy phase. When building `Agda-2.6.1.3`, it will fail with this error, as seen [here](https://gitlab.haskell.org/ghc/head.hackage/-/merge_requests/210#note_413083):
```
Could not parse the application primCharToNat a ≡ primCharToNat b
Operators used in the grammar:
≡ (infix operator, level 4) [_≡_ (/builds/ghc/head.hackage/ci/run/test-Agda-2.6.1.3/dist-newstyle/tmp/src-11665/Agda-2.6.1.3/src/data/lib/prim/Agda/Builtin/Equality.agda:7,6-9)]
when scope checking primCharToNat a ≡ primCharToNat b
Error: Failed to typecheck /builds/ghc/head.hackage/ci/run/test-Agda-2.6.1.3/dist-newstyle/tmp/src-11665/Agda-2.6.1.3/src/data/lib/prim/Agda/Builtin/Char/Properties.agda!
Generating Agda library interface files...
... /builds/ghc/head.hackage/ci/run/test-Agda-2.6.1.3/dist-newstyle/tmp/src-11665/Agda-2.6.1.3/src/data/lib/prim/Agda/Builtin/Bool.agda
... /builds/ghc/head.hackage/ci/run/test-Agda-2.6.1.3/dist-newstyle/tmp/src-11665/Agda-2.6.1.3/src/data/lib/prim/Agda/Builtin/Char.agda
... /builds/ghc/head.hackage/ci/run/test-Agda-2.6.1.3/dist-newstyle/tmp/src-11665/Agda-2.6.1.3/src/data/lib/prim/Agda/Builtin/Char/Properties.agda
cabal: Failed to build Agda-2.6.1.3 (which is required by test-Agda-1.0). See
the build log above for details.
```
And when building `Agda-2.6.2.1`, the most recent Hackage release, it will fail with this error, as seen [here](https://gitlab.haskell.org/ghc/head.hackage/-/merge_requests/210#note_413249):
```
Importing module Agda.Builtin.Bool not using the --no-subtyping
flag from a module which does.
Error: Failed to typecheck /builds/ghc/head.hackage/ci/run/test-Agda-2.6.2.1/dist-newstyle/tmp/src-11770/Agda-2.6.2.1/src/data/lib/prim/Agda/Builtin/Bool.agda!
Generating Agda library interface files...
... /builds/ghc/head.hackage/ci/run/test-Agda-2.6.2.1/dist-newstyle/tmp/src-11770/Agda-2.6.2.1/src/data/lib/prim/Agda/Builtin/Bool.agda
cabal: Failed to build Agda-2.6.2.1 (which is required by test-Agda-1.0). See
the build log above for details.
```
Unfortunately, I have not yet figured out a way to minimize the issue yet. The only way I know how to reproduce the issue is:
1. Set up `head.hackage`.
2. Run:
```
$ head.hackage/scripts/patch-tool unpack-patch Agda <AGDA_VER>
```
where `<AGDA_VER>` is one of `2.6.1.3` or `2.6.2.1`.
3. `cabal build Agda`
4. Run:
```
Agda_datadir=<PREFIX>/packages/Agda-<AGDA_VER>/src/data <PREFIX>/dist-newstyle/build/x86_64-linux/ghc-<GHC_VER>/Agda-<AGDA_VER>/build/agda/agda --no-libraries --local-interfaces -Werror <PREFIX>/packages/Agda-<AGDA_VER>/src/data/lib/prim/Agda/Builtin/Char/Properties.agda -v0
```
where `<PREFIX>` is the directory where you checked out `head.hackage`, `<GHC_VER>` is the version of HEAD you're using, and `<AGDA_VER>` is the same as in step (2).
Some notes:
* Bisecting reveals that commit 0e93023eef174262310737004d398bc7a606939a (`Tag inference work.`) is the culprit.
* In the case of `Agda-2.6.2.1`, the issue seems to involve roundtripping through interface files. Despite the error message given above, `Agda.Builtin.Bool` does in fact enable `--no-subtyping`. In fact, when `Agda` first parses this module, it correctly recognizes the presence of `--no-subtyping`. It's only after `Agda` writes `Agda.Builtin.Bool` to an interface file and reads it back that `Agda` mistakenly believes that `Agda.Builtin.Bool` does not enable `--no-subtyping`.
When `Agda` serializes a module to an interface file, it uses the `zlib` library to do so. Independently of this bug, I discovered that `zlib`'s test suite segfaults on HEAD—see #21186. However, that issue predates the `Tag inference work.` commit (see https://gitlab.haskell.org/ghc/ghc/-/issues/21186#note_413308), so that may just be a coincidence.
I'm opening this issue as a reminder to continue minimizing the `Agda` failure into something more tractable. For the time being, I'll mark `Agda` as being allowed to fail on the HEAD CI job.9.4.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/21186zlib test suite segfaults on HEAD2022-03-18T09:20:45ZRyan Scottzlib test suite segfaults on HEADTo reproduce, run:
```
$ git clone https://github.com/haskell/zlib && cd zlib/
$ cabal run test:tests -w ~/Software/ghc-9.3.20220302/bin/ghc
Resolving dependencies...
Up to date
zlib tests
property tests
decompress . compress = id...To reproduce, run:
```
$ git clone https://github.com/haskell/zlib && cd zlib/
$ cabal run test:tests -w ~/Software/ghc-9.3.20220302/bin/ghc
Resolving dependencies...
Up to date
zlib tests
property tests
decompress . compress = id (standard): OK (0.43s)
+++ OK, passed 100 tests; 124 discarded.
decompress . compress = id (Zlib -> GZipOrZLib): OK (0.37s)
+++ OK, passed 100 tests; 140 discarded.
decompress . compress = id (GZip -> GZipOrZlib): OK (0.34s)
+++ OK, passed 100 tests; 64 discarded.
concatenated gzip members: OK (0.36s)
+++ OK, passed 100 tests; 88 discarded.
multiple gzip members, boundaries (all 2-chunks): OK (0.02s)
+++ OK, passed 100 tests.
multiple gzip members, boundaries (all 3-chunks): Segmentation fault (core dumped)
```
I haven't had an opportunity to minimize the issue, but for the time being, all of the dependencies build on HEAD.9.4.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/21185Derived Generic1 instance for GADT no longer compiles on HEAD2022-10-14T21:10:30ZRyan ScottDerived Generic1 instance for GADT no longer compiles on HEADThis code compiles on GHC 9.2 and earlier:
```hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
import GHC.Generics
data family DF (a :: Type)
data instance DF (b ...This code compiles on GHC 9.2 and earlier:
```hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
import GHC.Generics
data family DF (a :: Type)
data instance DF (b :: Type) where
MkDF :: c -> DF c
deriving Generic1
```
However, it fails with HEAD:
```
$ ~/Software/ghc-9.3.20220302/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:10:15: error:
• Couldn't match type ‘Par1’ with ‘K1 R c’
Expected: Rep1 DF a
Actual: M1
D
('MetaData "DF" "Bug" "main" 'False)
(M1
C
('MetaCons "MkDF" 'PrefixI 'False)
(M1
S
('MetaSel
'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy)
Par1))
a
• In the expression: M1 (case x of MkDF g1 -> M1 (M1 (Par1 g1)))
In an equation for ‘from1’:
from1 x = M1 (case x of MkDF g1 -> M1 (M1 (Par1 g1)))
When typechecking the code for ‘from1’
in a derived instance for ‘Generic1 DF’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Generic1 DF’
|
10 | data instance DF (b :: Type) where
| ^
Bug.hs:10:15: error:
• Couldn't match type ‘Par1’ with ‘K1 R c’
Expected: Rep1 DF a
Actual: M1
D
('MetaData "DF" "Bug" "main" 'False)
(M1
C
('MetaCons "MkDF" 'PrefixI 'False)
(M1
S
('MetaSel
'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy)
Par1))
a
• In the pattern: M1 x
In an equation for ‘to1’:
to1 (M1 x) = case x of (M1 (M1 g1)) -> MkDF (unPar1 g1)
When typechecking the code for ‘to1’
in a derived instance for ‘Generic1 DF’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Generic1 DF’
|
10 | data instance DF (b :: Type) where
| ^
```
The `-ddump-deriv` output contains a clue as to why:
```
$ ~/Software/ghc-9.3.20220302/bin/ghc Bug.hs -ddump-deriv
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
==================== Derived instances ====================
Derived class instances:
instance GHC.Generics.Generic1 Bug.DF where
GHC.Generics.from1 x_a1EC
= GHC.Generics.M1
(case x_a1EC of
Bug.MkDF g1_a1ED
-> GHC.Generics.M1 (GHC.Generics.M1 (GHC.Generics.Par1 g1_a1ED)))
GHC.Generics.to1 (GHC.Generics.M1 x_a1EE)
= case x_a1EE of
(GHC.Generics.M1 (GHC.Generics.M1 g1_a1EF))
-> Bug.MkDF (GHC.Generics.unPar1 g1_a1EF)
Derived type family instances:
type GHC.Generics.Rep1 Bug.DF = GHC.Generics.D1
('GHC.Generics.MetaData "DF" "Bug" "main" 'GHC.Types.False)
(GHC.Generics.C1
('GHC.Generics.MetaCons
"MkDF" 'GHC.Generics.PrefixI 'GHC.Types.False)
(GHC.Generics.S1
('GHC.Generics.MetaSel
'GHC.Maybe.Nothing
'GHC.Generics.NoSourceUnpackedness
'GHC.Generics.NoSourceStrictness
'GHC.Generics.DecidedLazy)
(GHC.Generics.Rec0 c_a101)))
```
The `Rep1` instance is using `Rec0`, even though it should actually be using `Par1`. If I had to guess what patch is responsible for the regression, I would bet on it being !6976. I'll take a look.9.4.1Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/21155NativeAmd64Asm: ld.lld: error: can't create dynamic relocation R_X86_64_64 ag...2022-03-26T17:38:23ZGreg SteuckNativeAmd64Asm: ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segmentI suspect something in the recent adjustors work by @bgamari went sideways. At least my usual HEAD-building OpenBSD recipe started failing with:
```
"rm" -f rts/dist-install/build/libHSrts-ghc9.3.20220301.so
"inplace/bin/ghc-stage1" -th...I suspect something in the recent adjustors work by @bgamari went sideways. At least my usual HEAD-building OpenBSD recipe started failing with:
```
"rm" -f rts/dist-install/build/libHSrts-ghc9.3.20220301.so
"inplace/bin/ghc-stage1" -this-unit-id rts -shared -dynamic -dynload deploy -no-auto-link-packages `cat rts/dist-install/libs.depend` rts/dist-install/build/Adjustor.dyn_o rts/dist-install/build/Arena.dyn_o rts/dist-install/build/Capability.dyn_o rts/dist-install/build/CheckUnload.dyn_o rts/dist-install/build/CloneStack.dyn_o rts/dist-install/build/ClosureFlags.dyn_o rts/dist-install/build/ClosureSize.dyn_o rts/dist-install/build/Disassembler.dyn_o rts/dist-install/build/ExecPage.dyn_o rts/dist-install/build/FileLock.dyn_o rts/dist-install/build/ForeignExports.dyn_o rts/dist-install/build/Globals.dyn_o rts/dist-install/build/Hash.dyn_o rts/dist-install/build/Heap.dyn_o rts/dist-install/build/Hpc.dyn_o rts/dist-install/build/HsFFI.dyn_o rts/dist-install/build/IOManager.dyn_o rts/dist-install/build/IPE.dyn_o rts/dist-install/build/Inlines.dyn_o rts/dist-install/build/Interpreter.dyn_o rts/dist-install/build/LdvProfile.dyn_o rts/dist-install/build/Libdw.dyn_o rts/dist-install/build/LibdwPool.dyn_o rts/dist-install/build/Linker.dyn_o rts/dist-install/build/Messages.dyn_o rts/dist-install/build/OldARMAtomic.dyn_o rts/dist-install/build/PathUtils.dyn_o rts/dist-install/build/Pool.dyn_o rts/dist-install/build/Printer.dyn_o rts/dist-install/build/ProfHeap.dyn_o rts/dist-install/build/ProfilerReport.dyn_o rts/dist-install/build/ProfilerReportJson.dyn_o rts/dist-install/build/Profiling.dyn_o rts/dist-install/build/Proftimer.dyn_o rts/dist-install/build/RaiseAsync.dyn_o rts/dist-install/build/ReportMemoryMap.dyn_o rts/dist-install/build/RetainerProfile.dyn_o rts/dist-install/build/RetainerSet.dyn_o rts/dist-install/build/RtsAPI.dyn_o rts/dist-install/build/RtsDllMain.dyn_o rts/dist-install/build/RtsFlags.dyn_o rts/dist-install/build/RtsMain.dyn_o rts/dist-install/build/RtsMessages.dyn_o rts/dist-install/build/RtsStartup.dyn_o rts/dist-install/build/RtsSymbolInfo.dyn_o rts/dist-install/build/RtsSymbols.dyn_o rts/dist-install/build/RtsUtils.dyn_o rts/dist-install/build/STM.dyn_o rts/dist-install/build/Schedule.dyn_o rts/dist-install/build/Sparks.dyn_o rts/dist-install/build/SpinLock.dyn_o rts/dist-install/build/StableName.dyn_o rts/dist-install/build/StablePtr.dyn_o rts/dist-install/build/StaticPtrTable.dyn_o rts/dist-install/build/Stats.dyn_o rts/dist-install/build/StgCRun.dyn_o rts/dist-install/build/StgPrimFloat.dyn_o rts/dist-install/build/Task.dyn_o rts/dist-install/build/ThreadLabels.dyn_o rts/dist-install/build/ThreadPaused.dyn_o rts/dist-install/build/Threads.dyn_o rts/dist-install/build/Ticky.dyn_o rts/dist-install/build/Timer.dyn_o rts/dist-install/build/TopHandler.dyn_o rts/dist-install/build/Trace.dyn_o rts/dist-install/build/TraverseHeap.dyn_o rts/dist-install/build/TraverseHeapTest.dyn_o rts/dist-install/build/WSDeque.dyn_o rts/dist-install/build/Weak.dyn_o rts/dist-install/build/fs.dyn_o rts/dist-install/build/hooks/FlagDefaults.dyn_o rts/dist-install/build/hooks/LongGCSync.dyn_o rts/dist-install/build/hooks/MallocFail.dyn_o rts/dist-install/build/hooks/OnExit.dyn_o rts/dist-install/build/hooks/OutOfHeap.dyn_o rts/dist-install/build/hooks/StackOverflow.dyn_o rts/dist-install/build/sm/BlockAlloc.dyn_o rts/dist-install/build/sm/CNF.dyn_o rts/dist-install/build/sm/Compact.dyn_o rts/dist-install/build/sm/Evac.dyn_o rts/dist-install/build/sm/Evac_thr.dyn_o rts/dist-install/build/sm/GC.dyn_o rts/dist-install/build/sm/GCAux.dyn_o rts/dist-install/build/sm/GCUtils.dyn_o rts/dist-install/build/sm/MBlock.dyn_o rts/dist-install/build/sm/MarkWeak.dyn_o rts/dist-install/build/sm/NonMoving.dyn_o rts/dist-install/build/sm/NonMovingCensus.dyn_o rts/dist-install/build/sm/NonMovingMark.dyn_o rts/dist-install/build/sm/NonMovingScav.dyn_o rts/dist-install/build/sm/NonMovingShortcut.dyn_o rts/dist-install/build/sm/NonMovingSweep.dyn_o rts/dist-install/build/sm/Sanity.dyn_o rts/dist-install/build/sm/Scav.dyn_o rts/dist-install/build/sm/Scav_thr.dyn_o rts/dist-install/build/sm/Storage.dyn_o rts/dist-install/build/sm/Sweep.dyn_o rts/dist-install/build/eventlog/EventLog.dyn_o rts/dist-install/build/eventlog/EventLogWriter.dyn_o rts/dist-install/build/linker/CacheFlush.dyn_o rts/dist-install/build/linker/Elf.dyn_o rts/dist-install/build/linker/LoadArchive.dyn_o rts/dist-install/build/linker/M32Alloc.dyn_o rts/dist-install/build/linker/MMap.dyn_o rts/dist-install/build/linker/MachO.dyn_o rts/dist-install/build/linker/PEi386.dyn_o rts/dist-install/build/linker/SymbolExtras.dyn_o rts/dist-install/build/linker/elf_got.dyn_o rts/dist-install/build/linker/elf_plt.dyn_o rts/dist-install/build/linker/elf_plt_aarch64.dyn_o rts/dist-install/build/linker/elf_plt_arm.dyn_o rts/dist-install/build/linker/elf_reloc.dyn_o rts/dist-install/build/linker/elf_reloc_aarch64.dyn_o rts/dist-install/build/linker/elf_tlsgd.dyn_o rts/dist-install/build/linker/elf_util.dyn_o rts/dist-install/build/linker/macho/plt.dyn_o rts/dist-install/build/linker/macho/plt_aarch64.dyn_o rts/dist-install/build/posix/GetEnv.dyn_o rts/dist-install/build/posix/GetTime.dyn_o rts/dist-install/build/posix/OSMem.dyn_o rts/dist-install/build/posix/OSThreads.dyn_o rts/dist-install/build/posix/Select.dyn_o rts/dist-install/build/posix/Signals.dyn_o rts/dist-install/build/posix/TTY.dyn_o rts/dist-install/build/posix/Ticker.dyn_o rts/dist-install/build/adjustor/AdjustorPool.dyn_o rts/dist-install/build/adjustor/NativeAmd64.dyn_o rts/dist-install/build/StgCRunAsm.dyn_o rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o rts/dist-install/build/Apply.dyn_o rts/dist-install/build/Compact.dyn_o rts/dist-install/build/Exception.dyn_o rts/dist-install/build/HeapStackCheck.dyn_o rts/dist-install/build/PrimOps.dyn_o rts/dist-install/build/StgMiscClosures.dyn_o rts/dist-install/build/StgStartup.dyn_o rts/dist-install/build/StgStdThunks.dyn_o rts/dist-install/build/Updates.dyn_o rts/dist-install/build/AutoApply.dyn_o -optl-Wl,-z -optl-Wl,wxneeded -fPIC -dynamic -O0 -H64m -Wall -fllvm-fill-undef-with-garbage -Werror -this-unit-id rts -dcmm-lint -package-env - -i -irts -irts/dist-install/build -Irts/dist-install/build -irts/dist-install/build/./autogen -Irts/dist-install/build/./autogen -Irts/include/../dist-install/build/include -Irts/include/. -Irts/. -optP-DCOMPILING_RTS -optP-DFS_NAMESPACE=rts -O2 -Wcpp-undef -Wnoncanonical-monad-instances -fno-use-rpaths -optl-Wl,-zorigin -o rts/dist-install/build/libHSrts-ghc9.3.20220301.so
ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o
>>> referenced by NativeAmd64Asm.S
>>> rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o:(.text+0x50)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
gmake[1]: *** [rts/ghc.mk:353: rts/dist-install/build/libHSrts-ghc9.3.20220301.so] Error 1
gmake: *** [Makefile:128: all] Error 2
```
The file indeed has an R_X86_64_64 relocation:
```
% "inplace/bin/ghc-stage1" -optc--target=x86_64-unknown-openbsd -optc-Wall -optc-Werror -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-Wno-aggregate-return -optc-Wno-unused-label -optc-fno-strict-aliasing -optc-fno-common -optc-Irts/dist-install/build/./autogen -optc-Irts/include/../dist-install/build/include -optc-Irts/include/. -optc-Irts/. -optc-DCOMPILING_RTS -optc-DFS_NAMESPACE=rts -optc-Wno-unknown-pragmas -optc-O2 -optc-fomit-frame-pointer -optc-g -optc-DDYNAMIC -optc-DRtsWay=\"rts_dyn\" -fPIC -dynamic -O0 -H64m -Wall -fllvm-fill-undef-with-garbage -Werror -this-unit-id rts -dcmm-lint -package-env - -i -irts -irts/dist-install/build -Irts/dist-install/build -irts/dist-install/build/./autogen -Irts/dist-install/build/./autogen -Irts/include/../dist-install/build/include -Irts/include/. -Irts/. -optP-DCOMPILING_RTS -optP-DFS_NAMESPACE=rts -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/adjustor/NativeAmd64Asm.S -o rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o
% file rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o
rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o: ELF 64-bit LSB relocatable, x86-64, version 1
% objdump -r rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o
rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o: file format elf64-x86-64
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000050 R_X86_64_64 .text+0x0000000000000060
```
Doing a naive monkey-see-monkey-do doesn't help:
```
% git diff rts/adjustor/NativeAmd64Asm.S
diff --git a/rts/adjustor/NativeAmd64Asm.S b/rts/adjustor/NativeAmd64Asm.S
index 32e8da50fd..7c4444d46e 100644
--- a/rts/adjustor/NativeAmd64Asm.S
+++ b/rts/adjustor/NativeAmd64Asm.S
@@ -14,7 +14,7 @@
CSYM(x):
-#if defined(darwin_HOST_OS)
+#if defined(darwin_HOST_OS) || defined(openbsd_HOST_OS)
/*
* Note [Adjustor templates live in data section on Darwin]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -84,7 +84,7 @@ lcl_complex_ccall_adjustor_context: // See Note [Adjustors: Local symbol referen
DECLARE_CSYM(complex_ccall_adjustor_end)
-#if defined(darwin_HOST_OS)
+#if defined(darwin_HOST_OS) || defined(openbsd_HOST_OS)
/* See Note [Adjustor templates live in data section on Darwin]. */
.section __TEXT,__text
#endif
% "inplace/bin/ghc-stage1" -optc--target=x86_64-unknown-openbsd -optc-Wall -optc-Werror -optc-Wall -optc-Wextra -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs -optc-Wredundant-decls -optc-Wno-aggregate-return -optc-Wno-unused-label -optc-fno-strict-aliasing -optc-fno-common -optc-Irts/dist-install/build/./autogen -optc-Irts/include/../dist-install/build/include -optc-Irts/include/. -optc-Irts/. -optc-DCOMPILING_RTS -optc-DFS_NAMESPACE=rts -optc-Wno-unknown-pragmas -optc-O2 -optc-fomit-frame-pointer -optc-g -optc-DDYNAMIC -optc-DRtsWay=\"rts_dyn\" -fPIC -dynamic -O0 -H64m -Wall -fllvm-fill-undef-with-garbage -Werror -this-unit-id rts -dcmm-lint -package-env - -i -irts -irts/dist-install/build -Irts/dist-install/build -irts/dist-install/build/./autogen -Irts/dist-install/build/./autogen -Irts/include/../dist-install/build/include -Irts/include/. -Irts/. -optP-DCOMPILING_RTS -optP-DFS_NAMESPACE=rts -O2 -Wcpp-undef -Wnoncanonical-monad-instances -c rts/adjustor/NativeAmd64Asm.S -o rts/dist-install/build/adjustor/NativeAmd64Asm.dyn_o
rts/adjustor/NativeAmd64Asm.S:29:17: error:
error: expected string in directive
|
29 | .section __DATA,__data
| ^
.section __DATA,__data
^
rts/adjustor/NativeAmd64Asm.S:89:17: error:
error: expected string in directive
|
89 | .section __TEXT,__text
| ^
.section __TEXT,__text
^
`cc' failed in phase `Assembler'. (Exit code: 1)
%
```9.4.1https://gitlab.haskell.org/ghc/ghc/-/issues/21149servant-0.19 fails to compile on HEAD due to TypeErrors triggering more eagerly2022-08-24T17:52:16ZRyan Scottservant-0.19 fails to compile on HEAD due to TypeErrors triggering more eagerly`servant-0.19` fails to build on GHC HEAD. Here is a minimized version of the issue:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE PolyKi...`servant-0.19` fails to build on GHC HEAD. Here is a minimized version of the issue:
```hs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Bug where
import Data.Kind
import GHC.TypeLits
-- | No instance exists for @tycls (expr :> ...)@ because
-- @expr@ is not recognised.
type NoInstanceForSub (tycls :: k) (expr :: k') =
Text "There is no instance for " :<>: ShowType tycls
:<>: Text " (" :<>: ShowType expr :<>: Text " :> ...)"
-- | No instance exists for @expr@.
type NoInstanceFor (expr :: k) =
Text "There is no instance for " :<>: ShowType expr
-- | No instance exists for @tycls (expr :> ...)@ because @expr@ is not fully saturated.
type PartialApplication (tycls :: k) (expr :: k') =
NoInstanceForSub tycls expr
:$$: ShowType expr :<>: Text " expects " :<>: ShowType (Arity expr) :<>: Text " more arguments"
-- The arity of a combinator, i.e. the number of required arguments.
type Arity (ty :: k) = Arity' k
type Arity' :: k -> Nat
type family Arity' (ty :: k) :: Nat where
Arity' (_ -> ty) = 1 + Arity' ty
Arity' _ = 0
data (path :: k) :> (a :: *)
class HasLink endpoint where
instance TypeError (PartialApplication HasLink arr) => HasLink ((arr :: a -> b) :> sub)
```
This compiles with GHC 9.0.2 and 9.2.1, but fails to compile with HEAD:
```
$ ~/Software/ghc-9.3.20220216/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:40:10: error:
• There is no instance for HasLink (arr :> ...)
arr expects 1 + Arity' b more arguments
• In the ambiguity check for an instance declaration
In the instance declaration for ‘HasLink ((arr :: a -> b) :> sub)’
|
40 | instance TypeError (PartialApplication HasLink arr) => HasLink ((arr :: a -> b) :> sub)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
I'm unclear if this change is intended behavior or not, but since I couldn't find any mention of `TypeError`'s behavior changing in the [9.4 release notes](https://gitlab.haskell.org/ghc/ghc/-/blob/d734ef8f78203b856dcfaf19eaebfed6ec623850/docs/users_guide/9.4.1-notes.rst), I decided to open an issue.9.4.1sheafsam.derbyshire@gmail.comsheafsam.derbyshire@gmail.comhttps://gitlab.haskell.org/ghc/ghc/-/issues/21141Nondeterministic segfault on simple hspec program with GHC 9.0 only2022-07-12T13:55:43ZRyan ScottNondeterministic segfault on simple hspec program with GHC 9.0 only_(Originally reported at https://github.com/ekmett/reflection/issues/51.)_
The [`reflection-2.1.6`](https://hackage.haskell.org/package/reflection-2.1.6) test suite nondeterministically segfaults on Linux and macOS when compiled with GH..._(Originally reported at https://github.com/ekmett/reflection/issues/51.)_
The [`reflection-2.1.6`](https://hackage.haskell.org/package/reflection-2.1.6) test suite nondeterministically segfaults on Linux and macOS when compiled with GHC 9.0.1 or 9.0.2. The furthest I've managed to minimize the issue is:
```hs
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main (main) where
import Control.Exception (ArithException(..), evaluate)
import Numeric.Natural (Natural)
import "hspec" Test.Hspec
import "hspec" Test.Hspec.QuickCheck
import "QuickCheck" Test.QuickCheck (Negative(..), NonNegative(..))
main :: IO ()
main = hspec spec
spec :: Spec
spec =
describe "A" $ do
describe "B" $ do
prop "identity" $
\(NonNegative (i :: Integer)) -> i `shouldBe` i
prop "should throw an Underflow exception on negative inputs" $
\(Negative (i :: Integer)) ->
evaluate (fromInteger i :: Natural) `shouldThrow` (== Underflow)
```
With GHC 8.10.7 or 9.2.1, this works as expected:
```
$ ghc-8.10.7 Bug.hs && ./Bug
Loaded package environment from /home/ryanglscott/Documents/Hacking/Haskell/ci-maintenance/checkout/ekmett/reflection/.ghc.environment.x86_64-linux-8.10.7
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug ...
A
B
identity [✔]
+++ OK, passed 100 tests.
should throw an Underflow exception on negative inputs [✔]
+++ OK, passed 100 tests.
Finished in 0.0009 seconds
2 examples, 0 failures
$ ghc-9.2.1 Bug.hs && ./Bug
Loaded package environment from /home/ryanglscott/Documents/Hacking/Haskell/ci-maintenance/checkout/ekmett/reflection/.ghc.environment.x86_64-linux-9.2.1
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug ...
A
B
identity [✔]
+++ OK, passed 100 tests.
should throw an Underflow exception on negative inputs [✔]
+++ OK, passed 100 tests.
Finished in 0.0013 seconds
2 examples, 0 failures
```
With GHC 9.0.2, however, this can segfault:
```
$ ghc-9.0.2 Bug.hs && ./Bug
Loaded package environment from /home/ryanglscott/Documents/Hacking/Haskell/ci-maintenance/checkout/ekmett/reflection/.ghc.environment.x86_64-linux-9.0.2
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug ...
A
B
identity [✔]
+++ OK, passed 100 tests.
should throw an Underflow exception on negative inputs [ ]Segmentation fault (core dumped)
```
This is somewhat nondeterministic. In situations where it doesn't segfault, an incorrect runtime result will be observed:
```
$ ./Bug
A
B
identity [✔]
+++ OK, passed 100 tests.
should throw an Underflow exception on negative inputs [✘]
Failures:
Bug.hs:22:47:
1) A.B should throw an Underflow exception on negative inputs
Falsifiable (after 54 tests and 2 shrinks):
Negative {getNegative = -1}
did not get expected exception: ArithException
To rerun use: --match "/A/B/should throw an Underflow exception on negative inputs/"
Randomized with seed 1065015581
Finished in 0.0028 seconds
2 examples, 1 failure
```
This example proves remarkably resistant to minimization, as attempting to delete code in various places seemingly makes the bug disappear.9.0.3Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/21077GHC 9.2.1 typechecking regression with RankNTypes, TemplateHaskell, and compo...2023-08-04T17:02:49ZRyan ScottGHC 9.2.1 typechecking regression with RankNTypes, TemplateHaskell, and compound expressions_(Originally spun off from https://gitlab.haskell.org/ghc/ghc/-/issues/21038#note_407457)_
The `crux-llvm` library (specifically, [this code](https://github.com/GaloisInc/crucible/blob/e1308319eef8e0fcb55ed04df7eb2e9d5e87aac5/crux-llvm/..._(Originally spun off from https://gitlab.haskell.org/ghc/ghc/-/issues/21038#note_407457)_
The `crux-llvm` library (specifically, [this code](https://github.com/GaloisInc/crucible/blob/e1308319eef8e0fcb55ed04df7eb2e9d5e87aac5/crux-llvm/src/Crux/LLVM/Overrides.hs#L149-L153)) typechecks on GHC 9.0.2 and earlier, but fails to typecheck with GHC 9.2.1. I made an attempt to minimize the issue in #21038, but after trying again with that patch, I discovered that `crux-llvm` _still_ does not typecheck. It turns out that my minimization of the issue was a bit too minimal. Here is an example that better illustrates what is going on:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
data Foo = MkFoo () (forall a. a -> a)
worksOnAllGHCs1 :: Foo
worksOnAllGHCs1 = MkFoo () (\x -> x)
worksOnAllGHCs2 :: Foo
worksOnAllGHCs2 = MkFoo () $ \x -> x
worksOnAllGHCs42 :: Foo
worksOnAllGHCs42 = (MkFoo ()) $ \x -> x
doesn'tWorkOnGHC9'2 :: Foo
doesn'tWorkOnGHC9'2 = $([| MkFoo () |]) $ \x -> x
```
As the names suggest, all of the things functions will typecheck on GHC 9.0.2 and earlier. The `worksOnAllGHCs{1,2,3}` functions will typecheck on GHC 9.2.1, but `doesn'tWorkOnGHC9'2` will not:
```
$ ghc-9.2.1 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o, Bug.dyn_o )
Bug.hs:17:24: error:
• Couldn't match type: forall a. a -> a
with: p0 -> p0
Expected: (p0 -> p0) -> Foo
Actual: (forall a. a -> a) -> Foo
• In the first argument of ‘($)’, namely ‘(MkFoo ())’
In the expression: (MkFoo ()) $ \ x -> x
In an equation for ‘doesn'tWorkOnGHC9'2’:
doesn'tWorkOnGHC9'2 = (MkFoo ()) $ \ x -> x
|
17 | doesn'tWorkOnGHC9'2 = $([| MkFoo () |]) $ \x -> x
| ^^^^^^^^^^^^^^^^
```
The commit which introduced this regression is 9632f413dc90f39bc64586c064805f515a672ca0 (`Implement Quick Look impredicativity`).
Note that unlike the example in #21038, the expression being spliced isn't a simple identifier (i.e., a "head", to use Quick Look terminology), but rather a compound expression. @simonpj suggests [the following fix](https://gitlab.haskell.org/ghc/ghc/-/issues/21038#note_407705):
> Ah yes. Hmm. Reflecting on this, I think the Right Thing is *to treat a splice that is run in the renamer (i.e. an untyped TH splice) as using the "HsExpansion" mechanism*. See `Note [Handling overloaded and rebindable constructs]` in GHC.Tc.Rename.Expr.
>
> That is, the splice `$(expr)` turns into `HsExpanded $(expr) <result-of-running-splice>`. After all, it really *is* an expansion! Then the stuff in the type checker will deal smoothly with application chains. See `Note [Looking through HsExpanded]` in GHC.Tc.Gen.Head.
>
> In principle that should be pretty easy. But `Note [Delaying modFinalizers in untyped splices]` in GHC.Rename.Splice is a painful wart that will hurt us here.
>
> * Where might we store these modFinalizdrs in the HsExpanded? Maybe in the first (original expression) field?
> * Actually I think I favour separating them out entirely into a new extension constructor for `HsExpr GhcRn`. Currenlty we have
>
> ```
> type instance XXExpr GhcRn = HsExpansion (HsExpr GhcRn) (HsExpr GhcRn)
> type instance XXExpr GhcTc = XXExprGhcTc
> ```
>
> We could instead have
>
> ```
> type instance XXExpr GhcRn = XXExprGhcRn
>
> data XXExprGhcRn = ExpansionRn (HsExpansion (HsExpr GhcRn) (HsExpr GhcRn))
> | AddModFinalizedrs ThModFinalizers (HsExpr GhcRn)
> ```
>
> In exchange we can get rid of `HsSpliced` altogether.
> * We still need to call `addModFinalizersWithLclEnv` on those finalisers; so it looks as if we'd need to make `splitHsApps` monadic. That's a pain, but not actually difficult.
>
> I'm not certain of this. But *something* along these lines seems like the right solution.Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/21070gen_event_types requires an audit2022-04-01T17:27:27ZMatthew Pickeringgen_event_types requires an auditDue to the recent refactor of the eventlog event generation I discovered two bugs due to incorrect information in `gen_event_types.py`, in particular the size for `EVENT_IPE` and `EVENT_MEM_RETURN` were incorrect. The whole file should b...Due to the recent refactor of the eventlog event generation I discovered two bugs due to incorrect information in `gen_event_types.py`, in particular the size for `EVENT_IPE` and `EVENT_MEM_RETURN` were incorrect. The whole file should be audited to ensure there are no more of these bugs.9.4.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/21053Testsuite: Bogus error with "_build/stage1/lib" not found2022-02-09T08:57:59ZAndreas KlebingerTestsuite: Bogus error with "_build/stage1/lib" not foundAfter rebasing a number (10-20) of tests now seem to fail with this bogus error:
```
=====> CallArity1(normal) 1 of 1 [0, 0, 0]
cd "/tmp/ghctest-kejzo99g/test spaces/testsuite/tests/callarity/unittest/CallArity1.run" && "/home/andi/g...After rebasing a number (10-20) of tests now seem to fail with this bogus error:
```
=====> CallArity1(normal) 1 of 1 [0, 0, 0]
cd "/tmp/ghctest-kejzo99g/test spaces/testsuite/tests/callarity/unittest/CallArity1.run" && "/home/andi/ghc_infer/_build/stage1/bin/ghc" -o CallArity1 CallArity1.hs -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output -package ghc <
cd "/tmp/ghctest-kejzo99g/test spaces/testsuite/tests/callarity/unittest/CallArity1.run" && ./CallArity1 "_build/stage1/lib"<
Wrong exit code for CallArity1(normal)(expected 0 , actual 1 )
Stderr ( CallArity1 ):
CallArity1: Missing file: _build/stage1/lib/settings
*** unexpected failure for CallArity1(normal)
```
I suspect the path or content of the argument `"_build/stage1/lib"` is wrong. Either it should be an absolute path or contain a setting from that file? Not completely sure.Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/21038GHC 9.2.1 typechecking regression with RankNTypes and TemplateHaskell2022-02-14T13:59:23ZRyan ScottGHC 9.2.1 typechecking regression with RankNTypes and TemplateHaskellWhile porting some code over to use GHC 9.2.1, I noticed a typechecking regression that doesn't appear to be explained in the 9.2.1 release notes. Here is a minimal example:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell...While porting some code over to use GHC 9.2.1, I noticed a typechecking regression that doesn't appear to be explained in the 9.2.1 release notes. Here is a minimal example:
```hs
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module Bug where
data Foo = MkFoo (forall a. a -> a)
worksOnAllGHCs1 :: Foo
worksOnAllGHCs1 = MkFoo (\x -> x)
worksOnAllGHCs2 :: Foo
worksOnAllGHCs2 = MkFoo $ \x -> x
worksOnAllGHCs3 :: Foo
worksOnAllGHCs3 = $([| MkFoo |]) (\x -> x)
doesn'tWorkOnGHC9'2 :: Foo
doesn'tWorkOnGHC9'2 = $([| MkFoo |]) $ \x -> x
```
All four of these top-level functions will typecheck on GHC 9.0.2 and earlier. On GHC 9.2.1 and HEAD, `worksOnAllGHCs{1,2,3}` functions will typecheck, but the `doesn'tWorkOnGHC9'2` function will not typecheck:
```
$ ghc-9.2.1 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o, Bug.dyn_o )
Bug.hs:17:24: error:
• Couldn't match type: forall a. a -> a
with: p0 -> p0
Expected: (p0 -> p0) -> Foo
Actual: (forall a. a -> a) -> Foo
• In the first argument of ‘($)’, namely ‘(MkFoo)’
In the expression: (MkFoo) $ \ x -> x
In an equation for ‘doesn'tWorkOnGHC9'2’:
doesn'tWorkOnGHC9'2 = (MkFoo) $ \ x -> x
|
17 | doesn'tWorkOnGHC9'2 = $([| MkFoo |]) $ \x -> x
| ^^^^^^^^^^^^^
```
I'm unclear why using a Template Haskell splice would affect typechecking like this, so I believe this is a bug.9.2.2Ryan ScottRyan Scotthttps://gitlab.haskell.org/ghc/ghc/-/issues/21015indexXArrayAsY# primops make no attempt at handling alignment2022-03-26T17:29:21ZBen GamariindexXArrayAsY# primops make no attempt at handling alignmentIt appears that the unaligned index and store primops added in #14447 (see efd70cfb4b0b9932a880ab417d75eaf95da3d5e6) make no attempt at dealing with architectures that do not permit unaligned memory access. This is currently only problem...It appears that the unaligned index and store primops added in #14447 (see efd70cfb4b0b9932a880ab417d75eaf95da3d5e6) make no attempt at dealing with architectures that do not permit unaligned memory access. This is currently only problematic when using the LLVM backend to target ARMv7.Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/20959internal error: Evaluated a CAF (0xc98630) that was GC'd!2022-11-02T10:04:24ZMoritz Kieferinternal error: Evaluated a CAF (0xc98630) that was GC'd!## Summary
After trying to upgrade to GHC 9.0.2 from GHC 8.10.7, we are seeing a binary fail with
```
Internal error: Evaluated a CAF (0xc98630) that was GC'd!
```
This seems to happen non-deterministically but fairly reliably across a...## Summary
After trying to upgrade to GHC 9.0.2 from GHC 8.10.7, we are seeing a binary fail with
```
Internal error: Evaluated a CAF (0xc98630) that was GC'd!
```
This seems to happen non-deterministically but fairly reliably across a few runs. However seemingly irrelevant changes sometimes make the issue go away but I tried to minimize as far as possible while still reproducing fairly reliably.
This looks similar to #18680 but given that for us this seems to be a regression after upgrading (unable to reproduce this on 8.10.7), I’m opening a separate issue.
## Steps to reproduce
1. Download the package from https://purelyfunctional.org/downloads/ghc-rts-bug.tar.gz (Note that this contains a fairly large text file used as input data, the exact contents don’t seem to matter).
2. Run `cabal run` inside the project a few times until it fails. There is a `nix-shell` environment to reproduce exactly.
## Expected behavior
The binary succeeds without errors.
## Environment
* GHC version used: 9.0.2
Optional:
* Operating System: Ubuntu 20.04
* System Architecture: x86_649.4.1Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/208999.2: Assertion failures in Stats.c2022-03-20T16:25:05ZMatthew Pickering9.2: Assertion failures in Stats.cOn the 9.2 branch the two assertions fail in `Stats.c`. I think this is fixed by some commit on master but not sure which one.
```
@@ -1396,7 +1396,7 @@ stat_exitReport (void)
- sum.exit_cpu_ns)
...On the 9.2 branch the two assertions fail in `Stats.c`. I think this is fixed by some commit on master but not sure which one.
```
@@ -1396,7 +1396,7 @@ stat_exitReport (void)
- sum.exit_cpu_ns)
/ TimeToSecondsDbl(stats.cpu_ns);
- ASSERT(sum.productivity_cpu_percent >= 0);
+// ASSERT(sum.productivity_cpu_percent >= 0);
sum.productivity_elapsed_percent =
TimeToSecondsDbl(stats.elapsed_ns
(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
@@ -1405,7 +1405,7 @@ stat_exitReport (void)
- sum.exit_elapsed_ns)
/ TimeToSecondsDbl(stats.elapsed_ns);
- ASSERT(sum.productivity_elapsed_percent >= 0);
+ // ASSERT(sum.productivity_elapsed_percent >= 0);
for(uint32_t g = 0; g < RtsFlags.GcFlags.generations; ++g) {
const generation* gen = &generations[g];
```
This makes ticky profiling unusable so marking as highest priority.9.2.2Ben GamariMatthew PickeringBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/20769internal error: evacuate: strange closure type -1193213952 in shortbytestring...2022-02-10T13:55:53Zsterniinternal error: evacuate: strange closure type -1193213952 in shortbytestring test suite on aarch64-darwin with GHC 8.10.7## Summary
Test suite of `shortbytestring` 0.2.0.0 triggers the following issue on `aarch64-darwin`.
```
foldl1: prop-compiled: internal error: evacuate: strange closure type -1193213952
(GH...## Summary
Test suite of `shortbytestring` 0.2.0.0 triggers the following issue on `aarch64-darwin`.
```
foldl1: prop-compiled: internal error: evacuate: strange closure type -1193213952
(GHC version 8.10.7 for aarch64_apple_darwin)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
```
<details>
<summary>
full log
</summary>
```
setupCompilerEnvironmentPhase
Build with /nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7.
unpacking sources
unpacking source archive /nix/store/h05chc9cswniwpy8wr7vfa4w7niibn86-shortbytestring-0.2.0.0.tar.gz
source root is shortbytestring-0.2.0.0
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file shortbytestring-0.2.0.0/tests/Properties/ByteString/Short/Word16.hs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/private/tmp/nix-build-shortbytestring-0.2.0.0.drv-0/setup-package.conf.d -j1 -threaded -rtsopts
[1 of 1] Compiling Main ( /nix/store/4mdp8nhyfddh7bllbi7xszz7k9955n79-Setup.hs, /private/tmp/nix-build-shortbytestring-0.2.0.0.drv-0/Main.o )
Linking Setup ...
updateAutotoolsGnuConfigScriptsPhase
configuring
configureFlags: --verbose --prefix=/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/jfp2r6i9y5xd9gr6k2gfv69pbw7x4b2q-shortbytestring-0.2.0.0-doc/share/doc/shortbytestring-0.2.0.0 --with-gcc=clang --package-db=/private/tmp/nix-build-shortbytestring-0.2.0.0.drv-0/package.conf.d --ghc-options=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --extra-lib-dirs=/nix/store/vfx838xb8y5iifbpcj03fljagms0xvkc-ncurses-6.2/lib --extra-lib-dirs=/nix/store/92yf002wz1a2lz83pgx59hb8ng376wig-libffi-3.4.2/lib --extra-lib-dirs=/nix/store/hrmakx4jpq7b3zaj5cmsyclnrxfji8hb-gmp-6.2.1/lib --extra-include-dirs=/nix/store/hhydbralhhhfclxqr51kjpbv2gvz4g31-libiconv-50/include --extra-lib-dirs=/nix/store/hhydbralhhhfclxqr51kjpbv2gvz4g31-libiconv-50/lib --extra-include-dirs=/nix/store/cir5w76g2q5n7vbv5xzpmzlyl2j27gm2-libcxx-11.1.0-dev/include --extra-lib-dirs=/nix/store/v9h8pygmf5ld2p5fnnmcdnp073pnc3yj-libcxx-11.1.0/lib --extra-include-dirs=/nix/store/ajba7f9g3ijwjwrnshksyj21y3a57j4d-libcxxabi-11.1.0-dev/include --extra-lib-dirs=/nix/store/3hy11n7jlvd01fsxy43iipahhv5qv691-libcxxabi-11.1.0/lib --extra-lib-dirs=/nix/store/8draafqraz9q64i7lhg0wrs924gcgdqs-compiler-rt-libc-11.1.0/lib --extra-framework-dirs=/nix/store/k244b16r780gbzb63qwikg0p99gv33jm-apple-framework-CoreFoundation-11.0.0/Library/Frameworks --extra-include-dirs=/nix/store/p4k9fz4ym4f4kchy75sk8gwcd8fkndx4-libobjc-11.0.0/include --extra-lib-dirs=/nix/store/p4k9fz4ym4f4kchy75sk8gwcd8fkndx4-libobjc-11.0.0/lib
Using Parsec parser
Configuring shortbytestring-0.2.0.0...
Dependency base >=4.9.1.0 && <5: using base-4.14.3.0
Dependency bytestring >=0.10.8.1 && <0.11: using bytestring-0.10.12.0
Dependency exceptions ==0.10.*: using exceptions-0.10.4
Dependency primitive ==0.7.*: using primitive-0.7.3.0
Dependency template-haskell >=2.10 && <2.20: using template-haskell-2.16.0.0
Dependency text >=1.2.3.0 && <1.2.6: using text-1.2.4.1
Dependency word16 -any: using word16-0.1.0.0
Dependency word8 ==0.1.*: using word8-0.1.3
Dependency QuickCheck -any: using QuickCheck-2.14.2
Dependency base >=4.9.1.0 && <5: using base-4.14.3.0
Dependency bytestring >=0.10.8.1 && <0.11: using bytestring-0.10.12.0
Dependency deepseq -any: using deepseq-1.4.4.0
Dependency ghc-prim -any: using ghc-prim-0.6.1
Dependency shortbytestring -any: using shortbytestring-0.2.0.0
Dependency tasty -any: using tasty-1.4.2
Dependency tasty-quickcheck -any: using tasty-quickcheck-0.10.1.2
Dependency word16 -any: using word16-0.1.0.0
Dependency word8 -any: using word8-0.1.3
Source component graph:
component lib
component test:prop-compiled dependency lib
Configured component graph:
component shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
include base-4.14.3.0
include bytestring-0.10.12.0
include exceptions-0.10.4
include primitive-0.7.3.0-HMedJdQUTCQ79SiIUfisnA
include template-haskell-2.16.0.0
include text-1.2.4.1
include word16-0.1.0.0-CExu9wJDHvECBYWFZZ3bUE
include word8-0.1.3-3suFTzfCtfW1njTS38c5W6
component shortbytestring-0.2.0.0-KjRlxMXoRd19CZqAbCVjYT-prop-compiled
include QuickCheck-2.14.2-LnAekkDY9lpEHhc1zrdrc6
include base-4.14.3.0
include bytestring-0.10.12.0
include deepseq-1.4.4.0
include ghc-prim-0.6.1
include shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
include tasty-1.4.2-8uNODzuO8iuERCqkmI6DdY
include tasty-quickcheck-0.10.1.2-1X1mgcPW5Q86feFgT0Kvk0
include word16-0.1.0.0-CExu9wJDHvECBYWFZZ3bUE
include word8-0.1.3-3suFTzfCtfW1njTS38c5W6
Linked component graph:
unit shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
include base-4.14.3.0
include bytestring-0.10.12.0
include exceptions-0.10.4
include primitive-0.7.3.0-HMedJdQUTCQ79SiIUfisnA
include template-haskell-2.16.0.0
include text-1.2.4.1
include word16-0.1.0.0-CExu9wJDHvECBYWFZZ3bUE
include word8-0.1.3-3suFTzfCtfW1njTS38c5W6
Data.ByteString.Short=shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg:Data.ByteString.Short,Data.ByteString.Short.Decode=shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg:Data.ByteString.Short.Decode,Data.ByteString.Short.Encode=shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg:Data.ByteString.Short.Encode,Data.ByteString.Short.Internal=shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg:Data.ByteString.Short.Internal,Data.ByteString.Short.Word16=shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg:Data.ByteString.Short.Word16
unit shortbytestring-0.2.0.0-KjRlxMXoRd19CZqAbCVjYT-prop-compiled
include QuickCheck-2.14.2-LnAekkDY9lpEHhc1zrdrc6
include base-4.14.3.0
include bytestring-0.10.12.0
include deepseq-1.4.4.0
include ghc-prim-0.6.1
include shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
include tasty-1.4.2-8uNODzuO8iuERCqkmI6DdY
include tasty-quickcheck-0.10.1.2-1X1mgcPW5Q86feFgT0Kvk0
include word16-0.1.0.0-CExu9wJDHvECBYWFZZ3bUE
include word8-0.1.3-3suFTzfCtfW1njTS38c5W6
Ready component graph:
definite shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
depends base-4.14.3.0
depends bytestring-0.10.12.0
depends exceptions-0.10.4
depends primitive-0.7.3.0-HMedJdQUTCQ79SiIUfisnA
depends template-haskell-2.16.0.0
depends text-1.2.4.1
depends word16-0.1.0.0-CExu9wJDHvECBYWFZZ3bUE
depends word8-0.1.3-3suFTzfCtfW1njTS38c5W6
definite shortbytestring-0.2.0.0-KjRlxMXoRd19CZqAbCVjYT-prop-compiled
depends QuickCheck-2.14.2-LnAekkDY9lpEHhc1zrdrc6
depends base-4.14.3.0
depends bytestring-0.10.12.0
depends deepseq-1.4.4.0
depends ghc-prim-0.6.1
depends shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
depends tasty-1.4.2-8uNODzuO8iuERCqkmI6DdY
depends tasty-quickcheck-0.10.1.2-1X1mgcPW5Q86feFgT0Kvk0
depends word16-0.1.0.0-CExu9wJDHvECBYWFZZ3bUE
depends word8-0.1.3-3suFTzfCtfW1njTS38c5W6
Using Cabal-3.2.1.0 compiled by ghc-8.10
Using compiler: ghc-8.10.7
Using install prefix:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0
Executables installed in:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0/bin
Libraries installed in:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7/shortbytestring-0.2.0.0-HjOnEPJtzhYEio6pCkQgqg
Dynamic Libraries installed in:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7
Private executables installed in:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0/libexec/aarch64-osx-ghc-8.10.7/shortbytestring-0.2.0.0
Data files installed in:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0/share/aarch64-osx-ghc-8.10.7/shortbytestring-0.2.0.0
Documentation installed in:
/nix/store/jfp2r6i9y5xd9gr6k2gfv69pbw7x4b2q-shortbytestring-0.2.0.0-doc/share/doc/shortbytestring-0.2.0.0
Configuration files installed in:
/nix/store/8rpb4inrnn70nnd42vvqd0l0iagn0lsv-shortbytestring-0.2.0.0/etc
No alex found
Using ar found on system at:
/nix/store/nyl3gxdnjzidq7ky3nd65cblah1yfnyb-cctools-binutils-darwin-949.0.1/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 11.1.0 given by user at:
/nix/store/39hmshy4x50snqsrhfrqv2klfdix1cj5-clang-wrapper-11.1.0/bin/clang
Using ghc version 8.10.7 found on system at:
/nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7/bin/ghc
Using ghc-pkg version 8.10.7 found on system at:
/nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.24.2 found on system at:
/nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7/bin/hpc
Using hsc2hs version 0.68.7 found on system at:
/nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/fisv258lhaabkbirbxwp8hig8fiwc46d-hscolour-1.24.4/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/4sjvijh2aw94ljxbi564kgafwmxda991-cctools-binutils-darwin-wrapper-949.0.1/bin/ld
No pkg-config found
Using runghc version 8.10.7 found on system at:
/nix/store/fsnjsdqgdz2znslv0izw7d4mg6vl8rip-ghc-8.10.7/bin/runghc
Using strip found on system at:
/nix/store/39hmshy4x50snqsrhfrqv2klfdix1cj5-clang-wrapper-11.1.0/bin/strip
Using tar found on system at:
/nix/store/fih00xwmdhwc8zg8inc8hdm9kxf75vi4-gnutar-1.34/bin/tar
No uhc found
building
Preprocessing library for shortbytestring-0.2.0.0..
Building library for shortbytestring-0.2.0.0..
[1 of 5] Compiling Data.ByteString.Short.Internal ( lib/Data/ByteString/Short/Internal.hs, dist/build/Data/ByteString/Short/Internal.o, dist/build/Data/ByteString/Short/Internal.dyn_o )
[2 of 5] Compiling Data.ByteString.Short ( lib/Data/ByteString/Short.hs, dist/build/Data/ByteString/Short.o, dist/build/Data/ByteString/Short.dyn_o )
[3 of 5] Compiling Data.ByteString.Short.Encode ( lib/Data/ByteString/Short/Encode.hs, dist/build/Data/ByteString/Short/Encode.o, dist/build/Data/ByteString/Short/Encode.dyn_o )
[4 of 5] Compiling Data.ByteString.Short.Decode ( lib/Data/ByteString/Short/Decode.hs, dist/build/Data/ByteString/Short/Decode.o, dist/build/Data/ByteString/Short/Decode.dyn_o )
[5 of 5] Compiling Data.ByteString.Short.Word16 ( lib/Data/ByteString/Short/Word16.hs, dist/build/Data/ByteString/Short/Word16.o, dist/build/Data/ByteString/Short/Word16.dyn_o )
Preprocessing test suite 'prop-compiled' for shortbytestring-0.2.0.0..
Building test suite 'prop-compiled' for shortbytestring-0.2.0.0..
[1 of 3] Compiling Properties.ByteString.Short ( tests/Properties/ByteString/Short.hs, dist/build/prop-compiled/prop-compiled-tmp/Properties/ByteString/Short.o )
[2 of 3] Compiling Properties.ByteString.Short.Word16 ( tests/Properties/ByteString/Short/Word16.hs, dist/build/prop-compiled/prop-compiled-tmp/Properties/ByteString/Short/Word16.o )
[3 of 3] Compiling Main ( tests/Properties.hs, dist/build/prop-compiled/prop-compiled-tmp/Main.o )
Linking dist/build/prop-compiled/prop-compiled ...
running tests
Running 1 test suites...
Test suite prop-compiled: RUNNING...
All
StrictWord8
pack . unpack: OK
+++ OK, passed 100 tests.
unpack . pack: OK
+++ OK, passed 100 tests.
read . show: OK
+++ OK, passed 100 tests.
==: OK
+++ OK, passed 100 tests.
== refl: OK
+++ OK, passed 100 tests.
== symm: OK
+++ OK, passed 100 tests.
== pack unpack: OK
+++ OK, passed 100 tests.
compare: OK
+++ OK, passed 100 tests.
compare EQ: OK
+++ OK, passed 100 tests.
compare GT: OK
+++ OK, passed 100 tests.
compare LT: OK
+++ OK, passed 100 tests.
compare GT empty: OK
+++ OK, passed 100 tests; 21 discarded.
compare LT empty: OK
+++ OK, passed 100 tests; 31 discarded.
compare GT concat: OK
+++ OK, passed 100 tests; 27 discarded.
compare char: OK
+++ OK, passed 100 tests.
compare unsigned: OK
+++ OK, passed 1 test.
null: OK
+++ OK, passed 100 tests.
empty 0: OK
+++ OK, passed 1 test.
empty []: OK
+++ OK, passed 1 test.
mempty 0: OK
+++ OK, passed 1 test.
mempty []: OK
+++ OK, passed 1 test.
concat: OK (0.01s)
+++ OK, passed 100 tests.
concat [x,x]: OK
+++ OK, passed 100 tests.
concat [x,[]]: OK
+++ OK, passed 100 tests.
mconcat: OK (0.01s)
+++ OK, passed 100 tests.
mconcat [x,x]: OK
+++ OK, passed 100 tests.
mconcat [x,[]]: OK
+++ OK, passed 100 tests.
null: OK
+++ OK, passed 100 tests.
reverse: OK
+++ OK, passed 100 tests.
all: OK
+++ OK, passed 100 tests.
all ==: OK
+++ OK, passed 100 tests.
any: OK
+++ OK, passed 100 tests.
any ==: OK
+++ OK, passed 100 tests.
append: OK
+++ OK, passed 100 tests.
mappend: OK
+++ OK, passed 100 tests.
<>: OK
+++ OK, passed 100 tests.
stimes: OK
+++ OK, passed 100 tests.
break: OK
+++ OK, passed 100 tests.
break ==: OK
+++ OK, passed 100 tests.
break /=: OK
+++ OK, passed 100 tests.
break span: OK
+++ OK, passed 100 tests.
breakEnd: OK
+++ OK, passed 100 tests.
breakEnd: OK
+++ OK, passed 100 tests.
break breakSubstring: OK
+++ OK, passed 100 tests.
breakSubstring: OK
+++ OK, passed 100 tests; 27 discarded.
breakSubstring empty: OK
+++ OK, passed 100 tests.
break isSpace: OK
+++ OK, passed 100 tests.
singleton: OK
+++ OK, passed 100 tests.
cons: OK
+++ OK, passed 100 tests.
cons []: OK
+++ OK, passed 100 tests.
snoc: OK
+++ OK, passed 100 tests.
snoc []: OK
+++ OK, passed 100 tests.
drop: OK
+++ OK, passed 100 tests.
drop 10: OK
+++ OK, passed 100 tests.
dropWhile: OK
+++ OK, passed 100 tests.
dropWhile ==: OK
+++ OK, passed 100 tests.
dropWhile /=: OK
+++ OK, passed 100 tests.
dropWhile isSpace: OK
+++ OK, passed 100 tests.
take: OK
+++ OK, passed 100 tests.
take 10: OK
+++ OK, passed 100 tests.
takeWhile: OK
+++ OK, passed 100 tests.
takeWhile ==: OK
+++ OK, passed 100 tests.
takeWhile /=: OK
+++ OK, passed 100 tests.
takeWhile isSpace: OK
+++ OK, passed 100 tests.
dropEnd: OK
+++ OK, passed 100 tests.
dropWhileEnd: OK
+++ OK, passed 100 tests.
takeEnd: OK
+++ OK, passed 100 tests.
takeWhileEnd: OK
+++ OK, passed 100 tests.
length: OK
+++ OK, passed 100 tests.
count: OK
+++ OK, passed 100 tests.
filter: OK
+++ OK, passed 100 tests.
filter compose: OK
+++ OK, passed 100 tests.
filter ==: OK
+++ OK, passed 100 tests.
filter /=: OK
+++ OK, passed 100 tests.
partition: OK
+++ OK, passed 100 tests.
find: OK
+++ OK, passed 100 tests.
findIndex: OK
+++ OK, passed 100 tests.
findIndices: OK
+++ OK, passed 100 tests.
findIndices ==: OK
+++ OK, passed 100 tests.
elem: OK
+++ OK, passed 100 tests.
not elem: OK
+++ OK, passed 100 tests.
elemIndex: OK
+++ OK, passed 100 tests.
elemIndices: OK
+++ OK, passed 100 tests.
isPrefixOf: OK
+++ OK, passed 100 tests.
stripPrefix: OK
+++ OK, passed 100 tests.
isSuffixOf: OK
+++ OK, passed 100 tests.
stripSuffix: OK
+++ OK, passed 100 tests.
isInfixOf: OK
+++ OK, passed 100 tests.
map: OK
+++ OK, passed 100 tests.
map compose: OK
+++ OK, passed 100 tests.
replicate: OK
+++ OK, passed 100 tests.
replicate 0: OK
+++ OK, passed 100 tests.
span: OK
+++ OK, passed 100 tests.
span ==: OK
+++ OK, passed 100 tests.
span /=: OK
+++ OK, passed 100 tests.
spanEnd: OK
+++ OK, passed 100 tests.
split: OK
+++ OK, passed 100 tests.
split empty: OK
+++ OK, passed 100 tests.
splitWith: OK
+++ OK, passed 100 tests.
splitWith split: OK
+++ OK, passed 100 tests.
splitWith empty: OK
+++ OK, passed 100 tests.
splitWith length: OK
+++ OK, passed 100 tests.
splitAt: OK
+++ OK, passed 100 tests.
head: OK
+++ OK, passed 100 tests; 24 discarded.
last: OK
+++ OK, passed 100 tests; 34 discarded.
tail: OK
+++ OK, passed 100 tests; 32 discarded.
tail length: OK
+++ OK, passed 100 tests; 20 discarded.
init: OK
+++ OK, passed 100 tests; 19 discarded.
init length: OK
+++ OK, passed 100 tests; 28 discarded.
foldl: OK
+++ OK, passed 100 tests.
foldl': OK
+++ OK, passed 100 tests.
foldr: OK
+++ OK, passed 100 tests.
foldr': OK
+++ OK, passed 100 tests.
foldl cons: OK
+++ OK, passed 100 tests.
foldr cons: OK
+++ OK, passed 100 tests.
foldl special: OK
+++ OK, passed 100 tests.
foldr special: OK
+++ OK, passed 100 tests.
foldl1: prop-compiled: internal error: evacuate: strange closure type -1193213952
(GHC version 8.10.7 for aarch64_apple_darwin)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Test suite prop-compiled: FAIL
Test suite logged to: dist/test/shortbytestring-0.2.0.0-prop-compiled.log
0 of 1 test suites (0 of 1 test cases) passed.
builder for '/nix/store/s39a39yj4n39l7dsx1ynas8aqn8f0n6i-shortbytestring-0.2.0.0.drv' failed with exit code 1
```
</details>
## Steps to reproduce
1. Checkout `6daa4a5c045d40e6eae60a3b6e427e8700f1c07f` of nixpkgs
2. Build `nix-build -A haskellPackages.shortbytestring` on `aarch64-darwin`
Unclear if this can be reproduced 100% or is flaky.
## Expected behavior
`shortbytestring`'s test suite either succeeds or fails without hitting RTS (?) bailing out.
## Environment
* GHC version used: 8.10.7
Optional:
* Operating System: macOS
* System Architecture: aarch64-darwinBen GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/20735Wrong short representation using FFI on M1 macbook with GHC 8.10.7 with optim...2023-06-07T06:32:25ZGil Mizrahigilmi@posteo.netWrong short representation using FFI on M1 macbook with GHC 8.10.7 with optimizations## Summary
When calling a c function using the `ccall` api on M1 macs and passing it an `Int16`, the value is represented as if it is an `unsigned short int` instead of a `short int`, when compiling with optimizations.
## Steps to repr...## Summary
When calling a c function using the `ccall` api on M1 macs and passing it an `Int16`, the value is represented as if it is an `unsigned short int` instead of a `short int`, when compiling with optimizations.
## Steps to reproduce
### Code
- `code.c`:
```c
#include <stdio.h>
short int func(short int targetType)
{
printf("%d\n", targetType);
return (-1);
}
```
- `main.hs`:
```hs
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import Data.Int
foreign import ccall "code.h func" func :: Int16 -> IO Int16
main :: IO ()
main = do
res <- func (-2)
print res
```
### Compiling and running
#### With optimizations (bug)
```sh
$ ghc main.hs code.c -O
$ ./main
65534
-1
```
#### Without optimizations (correct)
```sh
$ ghc main.hs code.c
$ ./main
-2
-1
```
## Expected behavior
With optimizations should work the same as without optimizations.
## Environment
* GHC version used: 8.10.7 arm64
* cabal-install 3.4.0.0
* LLVM 13.0.0
Optional:
* Operating System: MacOS 12.0.1
* System Architecture: M1 chip (a.k.a. arm64, a.k.a. aarch64?)
---
<details><summary>Original ticket before the minimal reproduction steps. There are more interesting details here!</summary>
## Summary
I've tried using the [fpco/odbc](https://github.com/fpco/odbc) library on M1 and ran into issues when crossing the boundary between Haskell and C. To me this seem like a compiler bug, but let me know if you think differently.
More details, reproduction steps and some debugging thoughts in the [fpco/odbc issue #41 thread](https://github.com/fpco/odbc/issues/41), including the [behavior change when run with `traceShowId`](https://github.com/fpco/odbc/issues/41#issuecomment-976366010) and the [output of printing targetType in the C layer](https://github.com/fpco/odbc/issues/41#issuecomment-976366010).
This warning emitted when compiling the project also seems like a relevant suspect:
```sh
/var/folders/4p/vsznhmbx6p15bndr9g1fwv3m0000gn/T/ghc3543_0/ghc_1.s:354:2: error:
warning: instruction movi.2d with immediate #0 may not function correctly on this CPU, converting to equivalent movi.16b
movi.2d v0, #0000000000000000
^
|
354 | movi.2d v0, #0000000000000000
| ^
```
## Steps to reproduce
Described in the [fpco/odbc issue #41 thread](https://github.com/fpco/odbc/issues/41). The gist is:
### Compile the odbc project
```sh
$ git clone https://github.com/fpco/odbc
$ cabal v2-build odbc
```
### Run MSSQL with docker
```sh
$ docker run --name odbc-test-21433 --platform linux/arm64 -e ACCEPT_EULA=1 -e MSSQL_SA_PASSWORD=hUntEr202 -p 127.0.0.1:21433:1433 -d mcr.microsoft.com/azure-sql-edge
```
### Run the odbc exec
```sh
$ cabal v2-run odbc -- 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=192.168.0.146,21433;Uid=sa;Pwd=hUntEr202;Encrypt=no'
> CREATE TABLE mytest (a text);
Rows: 0
> insert into mytest values('abc');
Rows: 0
> select * from mytest;
UnsuccessfulReturnCode "getSize" (-1) "[unixODBC][Driver Manager]Program type out of range[unixODBC][Driver Manager]Program type out of range"
> select * from mytest;
[row 0]
a: "abc"
Rows: 1
```
This can be reproduced after restarting the `odbc` executable and running `select * from mytest;` again.
## Expected behavior
`select * from mytest;` should not fail, and return the same output it returned on the second run.
</details>9.2.4Ben GamariBen Gamari