GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2021-11-10T14:35:07Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/20646Broken C Calls on Darwin/AArch642021-11-10T14:35:07ZBen GamariBroken C Calls on Darwin/AArch64bgamari/test-primops> has discovered this failing C call shape on Darwin/AArch64 when using the LLVM backend (and presumably the NCG as well although the latter is currently too broken to judge):
```
C-Call correctness: FAIL (0.3...bgamari/test-primops> has discovered this failing C call shape on Darwin/AArch64 when using the LLVM backend (and presumably the NCG as well although the latter is currently too broken to judge):
```
C-Call correctness: FAIL (0.36s)
*** Failed! Falsified (after 1 test):
CCallDesc {callRet = SomeNumber @W16 0xef7c, callArgs = [SomeNumber @W8 0x90,SomeNumber @W8 0x2e,SomeNumber @W32 0xc4f525b5,SomeNumber @W16 0xfa13,SomeNumber @W32 0x3762a248,SomeNumber @W32 0xc91956ee,SomeNumber @W64 0x6d4c9d69ed69c6f6,SomeNumber @W32 0x6fc830de,SomeNumber @W32 0x20108891,SomeNumber @W16 0x65ae,SomeNumber @W64 0xd15099605cf94130,SomeNumber @W64 0xfa129274dad70ff,SomeNumber @W16 0x29ef,SomeNumber @W32 0x1a038aa5,SomeNumber @W64 0x33f45559c8ad4c8b,SomeNumber @W8 0x37,SomeNumber @W64 0x64827e4121b94909,SomeNumber @W8 0x38,SomeNumber @W32 0x88ac3077]}
[144,46,3304400309,64019,929210952,3373881070,7875842926644414198,1875390686,537954449,0,26030,15082723791219540272,28927,262220071,10735,165,3743711034358975627,55,0,61308] /= [144,46,3304400309,64019,929210952,3373881070,7875842926644414198,1875390686,537954449,26030,15082723791219540272,1126226630603010303,10735,436439717,3743711034358975627,55,7242489968968943881,56,2292985975,61308]
Use --quickcheck-replay=987633 to reproduce.
Use -p '/o0-llvm.C-Call correctness/' to rerun this test only.
```https://gitlab.haskell.org/ghc/ghc/-/issues/4335fromRational broken for Ratio a2021-11-02T09:27:32Zdaniel.is.fischerfromRational broken for Ratio aThe `Fractional` instance for `Ratio a` in GHC.Real defines
```
fromRational (x:%y) = fromInteger x :% fromInteger y
```
For fixed-width Integral types, that produces invalid results:
```
Prelude Data.Ratio> fromRational (1 % 2^3...The `Fractional` instance for `Ratio a` in GHC.Real defines
```
fromRational (x:%y) = fromInteger x :% fromInteger y
```
For fixed-width Integral types, that produces invalid results:
```
Prelude Data.Ratio> fromRational (1 % 2^32) :: Ratio Int
1 % 0
Prelude Data.Ratio> fromRational (3 % (2^32+9)) :: Ratio Int
3 % 9
```
Via `toRational`, these can be ported back to `Rational`.
`Ratio a` is generally broken for fixed-width types:
```
Prelude Data.Ratio> 1 % (minBound :: Int)
(-1) % (-2147483648)
```
but the particular brokenness of `fromRational` can be alleviated by reducing:
```
fromRational (x:%y) = fromInteger x % fromInteger y
{-# RULES
"fromRational/id" fromRational = id :: Rational -> Rational
#-}
```
I think it's better to throw a divide by zero error than to produce invalid results here.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 6.12.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"fromRational broken for Ratio a","status":"New","operating_system":"","component":"libraries/base","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.12.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"The `Fractional` instance for `Ratio a` in GHC.Real defines\r\n{{{\r\n fromRational (x:%y) = fromInteger x :% fromInteger y\r\n}}}\r\nFor fixed-width Integral types, that produces invalid results:\r\n{{{\r\nPrelude Data.Ratio> fromRational (1 % 2^32) :: Ratio Int\r\n1 % 0\r\nPrelude Data.Ratio> fromRational (3 % (2^32+9)) :: Ratio Int\r\n3 % 9\r\n}}}\r\nVia `toRational`, these can be ported back to `Rational`.\r\n\r\n`Ratio a` is generally broken for fixed-width types:\r\n{{{\r\nPrelude Data.Ratio> 1 % (minBound :: Int)\r\n(-1) % (-2147483648)\r\n}}}\r\nbut the particular brokenness of `fromRational` can be alleviated by reducing:\r\n{{{\r\n fromRational (x:%y) = fromInteger x % fromInteger y\r\n\r\n{-# RULES\r\n\"fromRational/id\" fromRational = id :: Rational -> Rational\r\n #-}\r\n}}}\r\nI think it's better to throw a divide by zero error than to produce invalid results here.","type_of_failure":"OtherFailure","blocking":[]} -->7.2.1Simon MarlowSimon Marlowhttps://gitlab.haskell.org/ghc/ghc/-/issues/19852PPC NCG: Unsigned compare with 16-bit constants broken2021-10-11T08:27:01ZPeter Trommlerptrommler@acm.orgPPC NCG: Unsigned compare with 16-bit constants brokenMany tests fail after c6de5805 because unicode encoding is messed up.
The root cause is a bug in PPC NCG where the first operand is
always sign extended (even for unsigned compare) when comparing with a small constant, i.e. a constant t...Many tests fail after c6de5805 because unicode encoding is messed up.
The root cause is a bug in PPC NCG where the first operand is
always sign extended (even for unsigned compare) when comparing with a small constant, i.e. a constant that would fit into 16 bits.
Fix is coming.Peter Trommlerptrommler@acm.orgZubinPeter Trommlerptrommler@acm.orghttps://gitlab.haskell.org/ghc/ghc/-/issues/16810Use explicit lazy binding around undefined in inlinable functions2021-10-04T14:19:35Zkazu-yamamotoUse explicit lazy binding around undefined in inlinable functions# Summary
`undefined` in inlinable functions are unintentionally evaluated if called strictly. An example:
```
{-# INLINE alloca #-}
alloca :: forall a b . Storable a => (Ptr a -> IO b) -> IO b
alloca =
allocaBytesAligned (sizeOf (u...# Summary
`undefined` in inlinable functions are unintentionally evaluated if called strictly. An example:
```
{-# INLINE alloca #-}
alloca :: forall a b . Storable a => (Ptr a -> IO b) -> IO b
alloca =
allocaBytesAligned (sizeOf (undefined :: a)) (alignment (undefined :: a))
```
# Steps to reproduce
Use `Foreign.Marshal.Alloc.alloca` with `Strict` language extension.
# Expected behavior
It should allocate a memory, not evaluating `undefined`. If `undefined`s are used in inlinable functions, lazy bindings must be used explicitly for GHC 8.0 or later.
# Environment
* GHC version used: 8.0 or later
Optional:8.9https://gitlab.haskell.org/ghc/ghc/-/issues/20392Infinite loop for Alternative instance for Maybe2021-09-23T11:17:57ZXwtekInfinite loop for Alternative instance for Maybe## Summary
The Alternative Instance for Maybe currently uses the default method provided by Alternative class, that currently does an infinite loop.
## Steps to reproduce
In ghci, run `some $ Just 5` or `many $ Just 5`. It will run in...## Summary
The Alternative Instance for Maybe currently uses the default method provided by Alternative class, that currently does an infinite loop.
## Steps to reproduce
In ghci, run `some $ Just 5` or `many $ Just 5`. It will run into infinite loop without outputting anything.
## Expected behavior
`some $ Just 5` and `many $ Just 5` should both return the same output as `Just $ repeat 5`
Using the property of some and many, we get:
`some v = (:) <$> v <*> many v`
for v = Just a, we get
`some (Just a) = (:) <$> (Just a) <*> many (Just a)`
Plugging in another property `many v = some v <|> pure []` gets us
`some (Just a) = (:) <$> (Just a) <*> (some (Just a) <|> pure [])`
If, some (Just a) return Nothing, then
`some (Just a) = (:) <$> (Just a) <*> (pure [])`
`some (Just a) = Just [a]`
a contradiction, so some (Just a) must return a Just
`some (Just a) = (:) <$> (Just a) <*> some (Just a)`
`some (Just a) = Just (a: (fromJust $ some (Just a)))`
`some (Just a) = Just (a: (fromJust $ Just (a: (fromJust $ ...))))`
`some (Just a) = Just (a: (a: ...))`
`some (Just a) = Just $ repeat a`
Similarly, for many
`many v = some v <|> pure []`
`many v = (Just $ repeat a) <|> pure []`
`many v = (Just $ repeat a)`
## Environment
* GHC version used: 9.0.1
* Operating System: Ubuntu 20.04
* System Architecture: x64Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/20066Rule "fromIntegral/Int->Natural" is inconsistent2021-09-21T16:58:42ZSylvain HenryRule "fromIntegral/Int->Natural" is inconsistentAs noticed by @trac-vdukhovni in https://gitlab.haskell.org/ghc/ghc/-/issues/20062#note_362750:
```haskell
import GHC.Natural
i :: Int
i = -10
main :: IO ()
main = let n :: Natural
n = fromIntegral i
in print n
```
...As noticed by @trac-vdukhovni in https://gitlab.haskell.org/ghc/ghc/-/issues/20062#note_362750:
```haskell
import GHC.Natural
i :: Int
i = -10
main :: IO ()
main = let n :: Natural
n = fromIntegral i
in print n
```
- with -O2: prints 18446744073709551606
- with -O0: throw "arithmetic underflow"
While it should always throw an exception (I guess? "fromIntegral" isn't precisely defined in the report).
GHC versions: 9.0, 9.2, HEADSylvain HenrySylvain Henryhttps://gitlab.haskell.org/ghc/ghc/-/issues/16197Strictness is not preserved under -O12021-09-21T14:11:59ZAlex LangStrictness is not preserved under -O1With -O0, the attached code prints:
```
> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O0 src/foo.hs; and ./src/foo
[1 of 1] Compiling Main ( src/foo.hs, src/foo.o ) [Optimisation flags changed]
Linking src/foo ...
("exec",0)
("depth...With -O0, the attached code prints:
```
> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O0 src/foo.hs; and ./src/foo
[1 of 1] Compiling Main ( src/foo.hs, src/foo.o ) [Optimisation flags changed]
Linking src/foo ...
("exec",0)
("depth",0)
("exec",1)
("depth",0)
```
But with -O1, it prints:
```
> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O1 src/foo.hs; and ./src/foo
[1 of 1] Compiling Main ( src/foo.hs, src/foo.o )
Linking src/foo ...
("depth",0)
("depth",0)
```
Reproduced with 8.4.1 and 8.6.2. Doesn't seem to happen under 8.2.0
<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 | me@alang.ca |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Strictness is not preserved under -O1","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["me@alang.ca"],"type":"Bug","description":"With -O0, the attached code prints:\r\n\r\n{{{\r\n> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O0 src/foo.hs; and ./src/foo\r\n[1 of 1] Compiling Main ( src/foo.hs, src/foo.o ) [Optimisation flags changed]\r\nLinking src/foo ...\r\n(\"exec\",0)\r\n(\"depth\",0)\r\n(\"exec\",1)\r\n(\"depth\",0)\r\n}}}\r\n\r\nBut with -O1, it prints:\r\n\r\n{{{\r\n> /usr/local/ghc/ghc-8.4.1.0/bin/ghc -O1 src/foo.hs; and ./src/foo\r\n[1 of 1] Compiling Main ( src/foo.hs, src/foo.o )\r\nLinking src/foo ...\r\n(\"depth\",0)\r\n(\"depth\",0)\r\n}}}\r\n\r\nReproduced with 8.4.1 and 8.6.2. Doesn't seem to happen under 8.2.0\r\n","type_of_failure":"OtherFailure","blocking":[]} -->8.8.1https://gitlab.haskell.org/ghc/ghc/-/issues/20338GHC.ByteOrder is broken2021-09-09T03:50:31ZAlexey KuleshevichGHC.ByteOrder is broken`GHC.ByteOrder.targetByteOrder` does not report endianness correctly.
Here is how to reproduce:
```haskell
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE CPP #-}
import Data.ByteString.Short.Internal
import GHC...`GHC.ByteOrder.targetByteOrder` does not report endianness correctly.
Here is how to reproduce:
```haskell
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE CPP #-}
import Data.ByteString.Short.Internal
import GHC.ByteOrder
import GHC.Exts
import GHC.IO
#include "MachDeps.h"
data MBA = MBA (MutableByteArray# RealWorld)
homeEndian :: ByteOrder
#ifdef WORDS_BIGENDIAN
homeEndian = BigEndian
#else
homeEndian = LittleEndian
#endif
makeSBS :: IO ShortByteString
makeSBS = do
MBA mba# <-
IO $ \s# ->
case newByteArray# 16# s# of
(# s'#, mba# #) -> (# s'#, MBA mba# #)
IO $ \s# -> (# writeWord64Array# mba# 0# 0x6162636465666768## s#, () #)
IO $ \s# -> (# writeWord64Array# mba# 1# 0x4142434445464748## s#, () #)
IO $ \s# ->
case unsafeFreezeByteArray# mba# s# of
(# s'#, ba# #) -> (# s'#, SBS ba# #)
main :: IO ()
main = do
putStrLn $ "GHC.ByteOrder.targetByteOrder: " ++ show targetByteOrder
putStrLn $ "homeEndian: " ++ show homeEndian
makeSBS >>= print
```
Running this on your regular little endian Intel CPU will produce expected output:
```shell
$ ghc endian.hs -fforce-recomp && ./endian
[1 of 1] Compiling Main ( endian.hs, endian.o )
Linking endian ...
GHC.ByteOrder.targetByteOrder: LittleEndian
homeEndian: LittleEndian
"hgfedcbaHGFEDCBA"
```
However when run on a big endian machine we get:
```shell
root@24bf49042aa4:/# ghc endian.hs -fforce-recomp && ./endian
[1 of 1] Compiling Main ( endian.hs, endian.o )
Linking endian ...
GHC.ByteOrder.targetByteOrder: LittleEndian
homeEndian: BigEndian
"abcdefghABCDEFGH"
```
As you can see from the output of `homeEndian` and the actual byte order in `ShortByteString` the endianness is indeed big endian as expected and `targetByteOrder` reports it incorrectly.
`ghc-byteorder` package works fine because it does the right thing and imports: [`<ghcautoconf.h>`](https://github.com/haskell-hvr/ghc-byteorder/blob/46e84c74ceed19e64023a32012be55d34e545194/src/GHC/ByteOrder.hs#L16-L17)
```haskell
-- Required for WORDS_BIGENDIAN
#include <ghcautoconf.h>
```
which I assume was forgotten when migrated to GHC codebase.
Adding this line to `GHC.ByteOrder` should do a trick:
```haskell
#include "MachDeps.h"
```
In order to debug and replicate this problem I used this project: https://github.com/multiarch/qemu-user-static#getting-started that was suggested to me by Leonhard Markert:
```shell
$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
$ docker run --rm -it s390x/ubuntu bash
root@24bf49042aa4:/# apt update && apt install ghc
```8.10.1https://gitlab.haskell.org/ghc/ghc/-/issues/18445targetByteOrder on s390x2021-09-09T03:50:06ZAndrew MartintargetByteOrder on s390x## Summary
I suspect that GHC detects the wrong byte order for s390x. This was originally reported [against the byte-order library](https://github.com/andrewthad/byte-order/issues/6), but it actually appears to be a problem with GHC its...## Summary
I suspect that GHC detects the wrong byte order for s390x. This was originally reported [against the byte-order library](https://github.com/andrewthad/byte-order/issues/6), but it actually appears to be a problem with GHC itself that manifests itself as a failure in `byte-order`'s test suite.
## Steps to reproduce
On an s390x host, run this in GHCi:
$ ghci
GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help
Prelude> import qualified GHC.ByteOrder
Prelude GHC.ByteOrder> GHC.ByteOrder.targetByteOrder
LittleEndian
## Expected behavior
This is a big-endian architecture. The result should be `BigEndian`.
## Environment
* GHC version used: Not yet certain. I do not have access to the machine that fails.8.10.6https://gitlab.haskell.org/ghc/ghc/-/issues/20191Unicode strings are mangled in GHC 9.0.12021-08-03T14:50:55ZBodigrimUnicode strings are mangled in GHC 9.0.1## Summary
GHC 9.0.1 seems to behave weirdly, when strings contain Unicode characters, while GHC 8.10.5 and HEAD work fine.
@mpickering Is it another manifestation of #19976?
## Steps to reproduce
```haskell
{-# OPTIONS_GHC -O1 #-}
...## Summary
GHC 9.0.1 seems to behave weirdly, when strings contain Unicode characters, while GHC 8.10.5 and HEAD work fine.
@mpickering Is it another manifestation of #19976?
## Steps to reproduce
```haskell
{-# OPTIONS_GHC -O1 #-}
import Data.Text ()
import Data.Text.Internal.Fusion (unstream)
import Data.Text.Internal.Fusion.Common (streamList)
main :: IO ()
main = print (unstream (streamList "\65536"))
```
```sh
$ ghc-9.0.1 Unicode.hs && ./Unicode
[1 of 1] Compiling Main ( Unicode.hs, Unicode.o )
Linking Unicode ...
"\65536\62464\61312"
```
## Expected behavior
I'd expect to have `"\65536"` back.
## Environment
* GHC version used: 9.0.19.0.2https://gitlab.haskell.org/ghc/ghc/-/issues/19158ghci's :type still ignores ill-kinded type application with -fdefer-type-errors2021-08-02T17:29:55ZJakob Brünkerghci's :type still ignores ill-kinded type application with -fdefer-type-errors## Summary
#16376 was fixed in 8.10, but the same problem is still there if -fdefer-type-errors is enabled.
## Steps to reproduce
Write `:set -fdefer-type-errors` followed by `:t id @Maybe` in ghci. It produces no ouput, neither an er...## Summary
#16376 was fixed in 8.10, but the same problem is still there if -fdefer-type-errors is enabled.
## Steps to reproduce
Write `:set -fdefer-type-errors` followed by `:t id @Maybe` in ghci. It produces no ouput, neither an error nor anything else.
## Expected output
```
<interactive>:1:5: warning: [-Wdeferred-type-errors]:
• Expecting one more argument to ‘Maybe’
Expected a type, but ‘Maybe’ has kind ‘* -> *’
• In the type ‘Maybe’
In the expression: id @Maybe
id @Maybe :: t
```
## Environment
* GHC version used: 9.1.20201223
Optional:
* Operating System: Ubuntu inside WSL2 inside Windows 10
* System Architecture: x86_64https://gitlab.haskell.org/ghc/ghc/-/issues/10957getExecutablePath adds " (deleted)" suffix if executable was deleted under linux2021-07-06T18:59:24ZaslpavelgetExecutablePath adds " (deleted)" suffix if executable was deleted under linuxIf we remove current executable or update it with a new one, getExecutablePath returns path with added " (deleted)" suffix. I think it is incorrect behavior
, for example if you updated binary and want to exec a new one, the obvious way ...If we remove current executable or update it with a new one, getExecutablePath returns path with added " (deleted)" suffix. I think it is incorrect behavior
, for example if you updated binary and want to exec a new one, the obvious way to go is to call getExecutablePath and use it. Moreover it is inconsistent between platforms. Problem stems from the fact the getExecutablePath is implemented as readlink on /proc/self/exe and it contains gibberish once file has been deleted.
Example:
```hs
module Main (main) where
import System.Environment (getExecutablePath)
import System.Directory (removeFile)
main :: IO ()
main = do
before <- getExecutablePath
putStrLn $ "Before: " ++ before
removeFile before
after <- getExecutablePath
putStrLn $ "After: " ++ after
```
Output:
```
$ ./getExecutablePath
Before: /mnt/data/Maggot/getExecutablePath
After: /mnt/data/Maggot/getExecutablePath (deleted)
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.10.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Core Libraries |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | aslpavel, ekmett |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"getExecutablePath adds \" (deleted)\" suffix if executable was deleted under linux","status":"New","operating_system":"","component":"Core Libraries","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["aslpavel","ekmett"],"type":"Bug","description":"If we remove current executable or update it with a new one, getExecutablePath returns path with added \" (deleted)\" suffix. I think it is incorrect behavior \r\n, for example if you updated binary and want to exec a new one, the obvious way to go is to call getExecutablePath and use it. Moreover it is inconsistent between platforms. Problem stems from the fact the getExecutablePath is implemented as readlink on /proc/self/exe and it contains gibberish once file has been deleted.\r\n\r\nExample:\r\n{{{#!hs\r\nmodule Main (main) where\r\n\r\nimport System.Environment (getExecutablePath)\r\nimport System.Directory (removeFile)\r\n\r\nmain :: IO ()\r\nmain = do\r\n before <- getExecutablePath\r\n putStrLn $ \"Before: \" ++ before\r\n removeFile before\r\n after <- getExecutablePath\r\n putStrLn $ \"After: \" ++ after\r\n}}}\r\n\r\nOutput:\r\n{{{\r\n$ ./getExecutablePath \r\nBefore: /mnt/data/Maggot/getExecutablePath\r\nAfter: /mnt/data/Maggot/getExecutablePath (deleted)\r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/6098debugger does not know the correct type for a newtype field2021-06-28T18:58:02Zphercekdebugger does not know the correct type for a newtype fieldThis bug is in 7.4.1. I think it was also in 7.0.3. It is also in the current head:\[\[BR\]\]
commit 921530b477867edb5158e4ad5bbbdb5c7c531c97\[\[BR\]\]
Date: Tue May 15 10:32:58 2012 +0100
Here is the console log. Notice that the type o...This bug is in 7.4.1. I think it was also in 7.0.3. It is also in the current head:\[\[BR\]\]
commit 921530b477867edb5158e4ad5bbbdb5c7c531c97\[\[BR\]\]
Date: Tue May 15 10:32:58 2012 +0100
Here is the console log. Notice that the type of allItems is resolved as TWrapper but it should be \[Int\]. Expressions in conditional breakpoints are failing because of this.
```
18:06 tm=3:2 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1035> cat bindings-bug.hs
newtype TWrapper = Wrapper
{ mItems :: [Int]
} deriving Show
main = print $ test $ Wrapper [1]
test Wrapper{ mItems = allItems } = id $
let headItem = head allItems in
headItem
18:06 tm=0 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1036> ../../ghc/stage2/build/tmp/ghc-stage2 -B. --interactive bindings-bug.hs
GHCi, version 7.5.20120515: 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 ( bindings-bug.hs, interpreted )
Ok, modules loaded: Main.
*Main> :break 7 37
Breakpoint 0 activated at bindings-bug.hs:(7,37)-(9,10)
*Main> :main
Stopped at bindings-bug.hs:(7,37)-(9,10)
_result :: Int = _
allItems :: TWrapper = _
[bindings-bug.hs:(7,37)-(9,10)] *Main> :list
6
vv
7 test Wrapper{ mItems = allItems } = id $
8 let headItem = head allItems in
9 headItem
^^
10
[bindings-bug.hs:(7,37)-(9,10)] *Main> head allItems
<interactive>:5:6:
Couldn't match expected type `[a0]' with actual type `TWrapper'
In the first argument of `head', namely `allItems'
In the expression: head allItems
In an equation for `it': it = head allItems
[bindings-bug.hs:(7,37)-(9,10)] *Main> :continue
1
*Main> :quit
Leaving GHCi.
18:06 tm=42 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib
1037>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 7.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Linux |
| Architecture | x86_64 (amd64) |
</details>
<!-- {"blocked_by":[],"summary":"debugger does not know the correct type for a newtype field","status":"New","operating_system":"Linux","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.5","keywords":["bindings","debugger"],"differentials":[],"test_case":"","architecture":"x86_64 (amd64)","cc":[""],"type":"Bug","description":"This bug is in 7.4.1. I think it was also in 7.0.3. It is also in the current head:[[BR]]\r\ncommit 921530b477867edb5158e4ad5bbbdb5c7c531c97[[BR]]\r\nDate: Tue May 15 10:32:58 2012 +0100\r\n\r\nHere is the console log. Notice that the type of allItems is resolved as TWrapper but it should be [Int]. Expressions in conditional breakpoints are failing because of this.\r\n\r\n\r\n{{{\r\n18:06 tm=3:2 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib\r\n1035> cat bindings-bug.hs\r\nnewtype TWrapper = Wrapper\r\n { mItems :: [Int]\r\n } deriving Show\r\n\r\nmain = print $ test $ Wrapper [1]\r\n\r\ntest Wrapper{ mItems = allItems } = id $\r\n let headItem = head allItems in\r\n headItem\r\n\r\n18:06 tm=0 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib\r\n1036> ../../ghc/stage2/build/tmp/ghc-stage2 -B. --interactive bindings-bug.hs\r\nGHCi, version 7.5.20120515: 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 ( bindings-bug.hs, interpreted )\r\nOk, modules loaded: Main.\r\n*Main> :break 7 37\r\nBreakpoint 0 activated at bindings-bug.hs:(7,37)-(9,10)\r\n*Main> :main \r\nStopped at bindings-bug.hs:(7,37)-(9,10)\r\n_result :: Int = _\r\nallItems :: TWrapper = _\r\n[bindings-bug.hs:(7,37)-(9,10)] *Main> :list\r\n6 \r\n vv\r\n7 test Wrapper{ mItems = allItems } = id $\r\n8 let headItem = head allItems in\r\n9 headItem\r\n ^^\r\n10 \r\n[bindings-bug.hs:(7,37)-(9,10)] *Main> head allItems\r\n\r\n<interactive>:5:6:\r\n Couldn't match expected type `[a0]' with actual type `TWrapper'\r\n In the first argument of `head', namely `allItems'\r\n In the expression: head allItems\r\n In an equation for `it': it = head allItems\r\n[bindings-bug.hs:(7,37)-(9,10)] *Main> :continue \r\n1\r\n*Main> :quit \r\nLeaving GHCi.\r\n18:06 tm=42 st=0 peter@phnm ~/haskell/ghc-working/inplace/lib\r\n1037> \r\n}}}\r\n","type_of_failure":"OtherFailure","blocking":[]} -->https://gitlab.haskell.org/ghc/ghc/-/issues/4471Incorrect Unicode output on Windows Console2021-06-24T22:08:45ZcamioIncorrect Unicode output on Windows ConsoleTo reproduce,
- start a windows console
- Change the console's font to a ttf unicode font, like "Lucida Console".
- Type "chcp 65001" to set it to the UTF-8 code page.
test.hs
```
main = putStrLn "∷⇒∀→←⋯⊢"
```
Output to the console i...To reproduce,
- start a windows console
- Change the console's font to a ttf unicode font, like "Lucida Console".
- Type "chcp 65001" to set it to the UTF-8 code page.
test.hs
```
main = putStrLn "∷⇒∀→←⋯⊢"
```
Output to the console is garbled. `runghc test.hs`:
```
∷⇒∀→←⋯⊢
→←⋯⊢
⋯⊢
∷⇒∀→←⋯⊢→←⋯⊢←⋯⊢⋯⊢⊢⊢⊢<stdout>: hFlush: permission denied (Permission denied)
```
Piping works correctly. `runghc test.hs > output && type output`:
```
∷⇒∀→←⋯⊢
```
ghci fails. `ghci test.hs`
```
GHCi, version 6.12.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
[1 of 1] Compiling Main ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
∷*** Exception: <stdout>: hPutChar: permission denied (Permission denied)
*Main>
```
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 6.12.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":"Incorrect Unicode output on Windows Console","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.12.3","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"To reproduce,\r\n\r\n * start a windows console\r\n * Change the console's font to a ttf unicode font, like \"Lucida Console\".\r\n * Type \"chcp 65001\" to set it to the UTF-8 code page.\r\n\r\ntest.hs\r\n{{{\r\nmain = putStrLn \"∷⇒∀→←⋯⊢\"\r\n}}}\r\n\r\nOutput to the console is garbled. `runghc test.hs`:\r\n{{{\r\n∷⇒∀→←⋯⊢\r\n→←⋯⊢\r\n⋯⊢\r\n∷⇒∀→←⋯⊢→←⋯⊢←⋯⊢⋯⊢⊢⊢⊢<stdout>: hFlush: permission denied (Permission denied)\r\n}}}\r\n\r\nPiping works correctly. `runghc test.hs > output && type output`:\r\n{{{\r\n∷⇒∀→←⋯⊢\r\n}}}\r\n\r\nghci fails. `ghci test.hs`\r\n{{{\r\nGHCi, version 6.12.3: 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\nLoading package ffi-1.0 ... linking ... done.\r\n[1 of 1] Compiling Main ( test.hs, interpreted )\r\nOk, modules loaded: Main.\r\n*Main> main\r\n∷*** Exception: <stdout>: hPutChar: permission denied (Permission denied)\r\n*Main>\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->Tamar ChristinaTamar Christinahttps://gitlab.haskell.org/ghc/ghc/-/issues/7277Recompilation check fails for TH unless functions are inlined2021-06-08T19:30:58ZorenbenkikiRecompilation check fails for TH unless functions are inlinedEven though [Issue 481](http://hackage.haskell.org/trac/ghc/ticket/481) is marked as closed, the fix is only partial. If a function inside $( ... ) is not inlined, then the dependency check fails. Attached is a full example, built around...Even though [Issue 481](http://hackage.haskell.org/trac/ghc/ticket/481) is marked as closed, the fix is only partial. If a function inside $( ... ) is not inlined, then the dependency check fails. Attached is a full example, built around the following code:
```
#ifdef NO_INLINE
{-# NOINLINE libraryFunction #-}
#endif
libraryFunction :: Q Exp
libraryFunction = [e| "Return X" |]
```
And the test:
```
case_library_function = $( libraryFunction ) @?= "Return A"
```
Here is are the relevant parts of RUNME.LOG:
```
+ rm -rf dist
+ cabal configure --enable-tests
Resolving dependencies...
Configuring dependency-bug-0.0.1...
+ sed -e 's/Return ./Return A/' -i src/Dependency/Library.hs
+ cabal build
Building dependency-bug-0.0.1...
Preprocessing library dependency-bug-0.0.1...
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )
Registering dependency-bug-0.0.1...
Preprocessing test suite 'Test' for dependency-bug-0.0.1...
[1 of 1] Compiling Main ( test/Main.hs, dist/build/Test/Test-tmp/Main.o )
Linking dist/build/Test/Test ...
+ cabal test
Running 1 test suites...
Test suite Test: RUNNING...
Test suite Test: PASS
Test suite logged to: dist/test/dependency-bug-0.0.1-Test.log
1 of 1 test suites (1 of 1 test cases) passed.
+ sed -e 's/Return ./Return B/' -i src/Dependency/Library.hs
+ cabal build
Building dependency-bug-0.0.1...
Preprocessing library dependency-bug-0.0.1...
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )
Registering dependency-bug-0.0.1...
Preprocessing test suite 'Test' for dependency-bug-0.0.1...
[1 of 1] Compiling Main ( test/Main.hs, dist/build/Test/Test-tmp/Main.o )
Linking dist/build/Test/Test ...
+ cabal test
Running 1 test suites...
Test suite Test: RUNNING...
Main:
library function: [Failed]
expected: "Return A"
but got: "Return B"
Test Cases Total
Passed 0 0
Failed 1 1
Total 1 1
Test suite Test: FAIL
Test suite logged to: dist/test/dependency-bug-0.0.1-Test.log
0 of 1 test suites (0 of 1 test cases) passed.
```
This is as expected; we changed the source to "Return B" but the test expects the library to "Return A" so it fails. So far, so good. However:
```
+ rm -rf dist
+ cabal configure --enable-tests -fwithout-inline
Resolving dependencies...
Configuring dependency-bug-0.0.1...
+ sed -e 's/Return ./Return A/' -i src/Dependency/Library.hs
+ cabal build
Building dependency-bug-0.0.1...
Preprocessing library dependency-bug-0.0.1...
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )
Registering dependency-bug-0.0.1...
Preprocessing test suite 'Test' for dependency-bug-0.0.1...
[1 of 1] Compiling Main ( test/Main.hs, dist/build/Test/Test-tmp/Main.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package dependency-bug-0.0.1 ... linking ... done.
Loading package filepath-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package unix-2.5.1.1 ... linking ... done.
Loading package directory-1.1.0.2 ... linking ... done.
Loading package cpphs-1.14 ... linking ... done.
Loading package haskell-src-exts-1.13.5 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package regex-base-0.93.2 ... linking ... done.
Loading package regex-posix-0.95.2 ... linking ... done.
Loading package language-haskell-extract-0.2.1 ... linking ... done.
Loading package ansi-terminal-0.5.5 ... linking ... done.
Loading package ansi-wl-pprint-0.6.4 ... linking ... done.
Loading package extensible-exceptions-0.1.1.4 ... linking ... done.
Loading package hostname-1.0 ... linking ... done.
Loading package time-1.4 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package xml-1.3.12 ... linking ... done.
Loading package test-framework-0.6.1 ... linking ... done.
Loading package test-framework-th-0.2.2 ... linking ... done.
Loading package HUnit-1.2.5.1 ... linking ... done.
Loading package test-framework-hunit-0.2.7 ... linking ... done.
Linking dist/build/Test/Test ...
+ cabal test
Running 1 test suites...
Test suite Test: RUNNING...
Test suite Test: PASS
Test suite logged to: dist/test/dependency-bug-0.0.1-Test.log
1 of 1 test suites (1 of 1 test cases) passed.
+ sed -e 's/Return ./Return B/' -i src/Dependency/Library.hs
+ cabal build
Building dependency-bug-0.0.1...
Preprocessing library dependency-bug-0.0.1...
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )
[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )
Registering dependency-bug-0.0.1...
Preprocessing test suite 'Test' for dependency-bug-0.0.1...
Linking dist/build/Test/Test ...
+ cabal test
Running 1 test suites...
Test suite Test: RUNNING...
Test suite Test: PASS
Test suite logged to: dist/test/dependency-bug-0.0.1-Test.log
1 of 1 test suites (1 of 1 test cases) passed.
```
As you can see, without-inline the 2nd build did not recompile the test, even though it should have. It only re-linked the test, so it kept seeing "Return A" even though the library actually does "Return B".
In my real code, there are no NO/INLINE pragmas; however, the TH code is complex enough that it is not inlined, which causes the same problem. I had to use the pragma to keep the example short.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ---------------- |
| Version | 7.4.2 |
| 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":"Recompilation check fails for TH unless functions are inlined","status":"New","operating_system":"","component":"Template Haskell","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.4.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Even though [http://hackage.haskell.org/trac/ghc/ticket/481 Issue 481] is marked as closed, the fix is only partial. If a function inside $( ... ) is not inlined, then the dependency check fails. Attached is a full example, built around the following code:\r\n\r\n{{{\r\n#ifdef NO_INLINE\r\n{-# NOINLINE libraryFunction #-}\r\n#endif\r\n\r\nlibraryFunction :: Q Exp\r\nlibraryFunction = [e| \"Return X\" |]\r\n}}}\r\n\r\nAnd the test:\r\n\r\n{{{\r\ncase_library_function = $( libraryFunction ) @?= \"Return A\"\r\n}}}\r\n\r\nHere is are the relevant parts of RUNME.LOG:\r\n\r\n{{{\r\n+ rm -rf dist\r\n+ cabal configure --enable-tests\r\nResolving dependencies...\r\nConfiguring dependency-bug-0.0.1...\r\n+ sed -e 's/Return ./Return A/' -i src/Dependency/Library.hs\r\n+ cabal build\r\nBuilding dependency-bug-0.0.1...\r\nPreprocessing library dependency-bug-0.0.1...\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )\r\nRegistering dependency-bug-0.0.1...\r\nPreprocessing test suite 'Test' for dependency-bug-0.0.1...\r\n[1 of 1] Compiling Main ( test/Main.hs, dist/build/Test/Test-tmp/Main.o )\r\nLinking dist/build/Test/Test ...\r\n+ cabal test\r\nRunning 1 test suites...\r\nTest suite Test: RUNNING...\r\nTest suite Test: PASS\r\nTest suite logged to: dist/test/dependency-bug-0.0.1-Test.log\r\n1 of 1 test suites (1 of 1 test cases) passed.\r\n+ sed -e 's/Return ./Return B/' -i src/Dependency/Library.hs\r\n+ cabal build\r\nBuilding dependency-bug-0.0.1...\r\nPreprocessing library dependency-bug-0.0.1...\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )\r\nRegistering dependency-bug-0.0.1...\r\nPreprocessing test suite 'Test' for dependency-bug-0.0.1...\r\n[1 of 1] Compiling Main ( test/Main.hs, dist/build/Test/Test-tmp/Main.o )\r\nLinking dist/build/Test/Test ...\r\n+ cabal test\r\nRunning 1 test suites...\r\nTest suite Test: RUNNING...\r\nMain:\r\n library function: [Failed]\r\nexpected: \"Return A\"\r\n but got: \"Return B\"\r\n\r\n Test Cases Total\r\n Passed 0 0\r\n Failed 1 1\r\n Total 1 1\r\nTest suite Test: FAIL\r\nTest suite logged to: dist/test/dependency-bug-0.0.1-Test.log\r\n0 of 1 test suites (0 of 1 test cases) passed.\r\n\r\n}}}\r\n\r\nThis is as expected; we changed the source to \"Return B\" but the test expects the library to \"Return A\" so it fails. So far, so good. However:\r\n\r\n{{{\r\n+ rm -rf dist\r\n+ cabal configure --enable-tests -fwithout-inline\r\nResolving dependencies...\r\nConfiguring dependency-bug-0.0.1...\r\n+ sed -e 's/Return ./Return A/' -i src/Dependency/Library.hs\r\n+ cabal build\r\nBuilding dependency-bug-0.0.1...\r\nPreprocessing library dependency-bug-0.0.1...\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )\r\nRegistering dependency-bug-0.0.1...\r\nPreprocessing test suite 'Test' for dependency-bug-0.0.1...\r\n[1 of 1] Compiling Main ( test/Main.hs, dist/build/Test/Test-tmp/Main.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.4.0.0 ... linking ... done.\r\nLoading package deepseq-1.3.0.0 ... linking ... done.\r\nLoading package containers-0.4.2.1 ... linking ... done.\r\nLoading package pretty-1.1.1.0 ... linking ... done.\r\nLoading package template-haskell ... linking ... done.\r\nLoading package dependency-bug-0.0.1 ... linking ... done.\r\nLoading package filepath-1.3.0.0 ... linking ... done.\r\nLoading package old-locale-1.0.0.4 ... linking ... done.\r\nLoading package old-time-1.1.0.0 ... linking ... done.\r\nLoading package bytestring-0.9.2.1 ... linking ... done.\r\nLoading package unix-2.5.1.1 ... linking ... done.\r\nLoading package directory-1.1.0.2 ... linking ... done.\r\nLoading package cpphs-1.14 ... linking ... done.\r\nLoading package haskell-src-exts-1.13.5 ... linking ... done.\r\nLoading package transformers-0.3.0.0 ... linking ... done.\r\nLoading package mtl-2.1.2 ... linking ... done.\r\nLoading package regex-base-0.93.2 ... linking ... done.\r\nLoading package regex-posix-0.95.2 ... linking ... done.\r\nLoading package language-haskell-extract-0.2.1 ... linking ... done.\r\nLoading package ansi-terminal-0.5.5 ... linking ... done.\r\nLoading package ansi-wl-pprint-0.6.4 ... linking ... done.\r\nLoading package extensible-exceptions-0.1.1.4 ... linking ... done.\r\nLoading package hostname-1.0 ... linking ... done.\r\nLoading package time-1.4 ... linking ... done.\r\nLoading package random-1.0.1.1 ... linking ... done.\r\nLoading package text-0.11.2.3 ... linking ... done.\r\nLoading package xml-1.3.12 ... linking ... done.\r\nLoading package test-framework-0.6.1 ... linking ... done.\r\nLoading package test-framework-th-0.2.2 ... linking ... done.\r\nLoading package HUnit-1.2.5.1 ... linking ... done.\r\nLoading package test-framework-hunit-0.2.7 ... linking ... done.\r\nLinking dist/build/Test/Test ...\r\n+ cabal test\r\nRunning 1 test suites...\r\nTest suite Test: RUNNING...\r\nTest suite Test: PASS\r\nTest suite logged to: dist/test/dependency-bug-0.0.1-Test.log\r\n1 of 1 test suites (1 of 1 test cases) passed.\r\n+ sed -e 's/Return ./Return B/' -i src/Dependency/Library.hs\r\n+ cabal build\r\nBuilding dependency-bug-0.0.1...\r\nPreprocessing library dependency-bug-0.0.1...\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.o )\r\n[1 of 1] Compiling Dependency.Library ( src/Dependency/Library.hs, dist/build/Dependency/Library.p_o )\r\nRegistering dependency-bug-0.0.1...\r\nPreprocessing test suite 'Test' for dependency-bug-0.0.1...\r\nLinking dist/build/Test/Test ...\r\n+ cabal test\r\nRunning 1 test suites...\r\nTest suite Test: RUNNING...\r\nTest suite Test: PASS\r\nTest suite logged to: dist/test/dependency-bug-0.0.1-Test.log\r\n1 of 1 test suites (1 of 1 test cases) passed.\r\n}}}\r\n\r\nAs you can see, without-inline the 2nd build did not recompile the test, even though it should have. It only re-linked the test, so it kept seeing \"Return A\" even though the library actually does \"Return B\".\r\n\r\nIn my real code, there are no NO/INLINE pragmas; however, the TH code is complex enough that it is not inlined, which causes the same problem. I had to use the pragma to keep the example short.","type_of_failure":"OtherFailure","blocking":[]} -->8.0.1https://gitlab.haskell.org/ghc/ghc/-/issues/19771TH recompilation check is defeated by packages2021-06-08T19:30:57ZMatthew PickeringTH recompilation check is defeated by packagesIt's possible to defeat the recompilation checker by using and then modifying a TH definition from another package.
Reproducer: https://github.com/mpickering/special-fiesta
In the example there are two packages. Package `p` defines a l...It's possible to defeat the recompilation checker by using and then modifying a TH definition from another package.
Reproducer: https://github.com/mpickering/special-fiesta
In the example there are two packages. Package `p` defines a library
```
module Lib where
{-# NOINLINE p #-}
p = [| 0 |]
```
which is then used in package `q`:
```
module Main where
import Lib
main = print $(p)
```
Running the executable prints `0` initially.
Then modifying the library `p`,
```
module Lib where
p = [| 1 |]
```
when the executable is rerun the result should be printing `1`, but it still prints `0`.
The recompilation check fails because the ABI for `Lib` didn't change, and so GHC concluded that it didn't need to recompile `Main` again.
The logic for computing stable modules only considers stability for home package modules when it should also consider whether the object files for dependencies have changed.
A correct fix is to take the hash of all the object files in the transitive dependencies of a module (such as is already done for plugins)Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/19680case over signum of Integer is incorrect in GHC 9.22021-05-13T01:55:47ZBodigrimcase over signum of Integer is incorrect in GHC 9.2## Summary
`case` over `signum` of `Integer` returns an incorrect result.
## Steps to reproduce
```
GHCi, version 9.2.0.20210331: https://www.haskell.org/ghc/ :? for help
ghci> signum (-1 :: Integer)
-1
ghci> case signum (-1 :: Integ...## Summary
`case` over `signum` of `Integer` returns an incorrect result.
## Steps to reproduce
```
GHCi, version 9.2.0.20210331: https://www.haskell.org/ghc/ :? for help
ghci> signum (-1 :: Integer)
-1
ghci> case signum (-1 :: Integer) of 1 -> "FOO"; -1 -> "OK"; 0 -> "BAR"; _ -> "FAIL"
"FAIL"
```
## Expected behavior
I would expect the second line to return `"OK"`.
## Environment
* GHC version used: 9.2.0.202103319.2.1Matthew PickeringMatthew Pickeringhttps://gitlab.haskell.org/ghc/ghc/-/issues/17950OFD locking breaks on 32-bit glibc2021-05-04T23:17:40ZBen GamariOFD locking breaks on 32-bit glibcAs noted in #17941, some [glibc versions](https://sourceware.org/bugzilla/show_bug.cgi?id=20251) use the wrong `struct` layout for the open fd locking `fcntl` on 32-bit platforms. This results in GHC being broken on many 32-bit platforms...As noted in #17941, some [glibc versions](https://sourceware.org/bugzilla/show_bug.cgi?id=20251) use the wrong `struct` layout for the open fd locking `fcntl` on 32-bit platforms. This results in GHC being broken on many 32-bit platforms by default.8.10.2Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/19147Error in accounting for GC cpu time in sequential collections2021-05-04T23:17:39ZDouglas Wilsondouglas@well-typed.comError in accounting for GC cpu time in sequential collections## Summary
stat_endGC accounts for cpu time consumed by a garbage collection the following fragment:
```
for (unsigned int i=0; i < par_n_threads; i++) {
gc_thread *gct = gc_threads[i];
ASSERT(gct->gc_end...## Summary
stat_endGC accounts for cpu time consumed by a garbage collection the following fragment:
```
for (unsigned int i=0; i < par_n_threads; i++) {
gc_thread *gct = gc_threads[i];
ASSERT(gct->gc_end_cpu >= gct->gc_start_cpu);
stats.gc.cpu_ns += gct->gc_end_cpu - gct->gc_start_cpu;
}
```
however, this is incorrect when accounting for a sequential collection when n_capabilities > 1. In this case, par_n_threads will be set to 1. However the cpu stats will not necessarily be on capability 0(i.e. in gc_threads[0]) which the fragment above assumes. The stats will be on the capability of the gc leader.
EDIT:
I've also seen
```
for (i=0; i < n_gc_threads; i++) {
copied += RELAXED_LOAD(&gc_threads[i]->copied);
}
```
in GC.c seems to have the same problem. Holding off fixing this for now, since I now suspect I may be confused
## Steps to reproduce
I've not constructed a demonstration.
## Expected behavior
n/a
## Environment
* GHC version used: headhttps://gitlab.haskell.org/ghc/ghc/-/issues/11126Entered absent arg in a Repa program2021-04-29T21:20:00ZtuplanollaEntered absent arg in a Repa programConsider the following program.
```hs
module Main where
import Data.Array.Repa
data Stuff = !(Array U DIM1 Double) `With` !Double deriving Show
through :: Maybe Double -> Stuff -> Stuff
m `through` (a `With` _) =
let b = a +^ (nega...Consider the following program.
```hs
module Main where
import Data.Array.Repa
data Stuff = !(Array U DIM1 Double) `With` !Double deriving Show
through :: Maybe Double -> Stuff -> Stuff
m `through` (a `With` _) =
let b = a +^ (negate `smap` sumS (extend (Z :. All :. (1 :: Int)) a))
c = maybe b (const (negate `smap` a)) m in
computeUnboxedS c `With` sumAllS b
main :: IO ()
main = print $ Just 1 `through` (fromListUnboxed (Z :. 1) [1] `With` 1)
```
It should produce the following result once run.
```hs
AUnboxed (Z :. 1) (fromList [-1.0]) `With` 0.0
```
However, when built using `repa-3.4.0.1` and compiled with the options
`-O3 -Wall -funfolding-keeness-factor1000 -funfolding-use-threshold1000`,
it crashes as follows.
```hs
Main: Oops! Entered absent arg arr2 Array D DIM1 Double
```
Adding `-fno-strictness` to the compiler options or
removing strictness annotations from the code makes the problem disappear, so
this looks like a strictness analyzer problem.
The libraries used were
- `QuickCheck-2.8.1`,
- `array-0.5.1.0`,
- `base-4.8.1.0`,
- `bytestring-0.10.6.0`,
- `containers-0.5.6.2`,
- `deepseq-1.4.1.1`,
- `ghc-prim-0.4.0.0`,
- `integer-gmp-1.0.0.0`,
- `pretty-1.1.2.0`,
- `primitive-0.6`,
- `random-1.1`,
- `repa-3.4.0.1`,
- `template-haskell-2.10.0.0`,
- `tf-random-0.5`,
- `time-1.5.0.1`,
- `transformers-0.4.2.0` and
- `vector-0.10.12.3`.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | ------------ |
| Version | 7.10.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":"Entered absent arg in a Repa program","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"7.10.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Consider the following program.\r\n\r\n{{{#!hs\r\nmodule Main where\r\n\r\nimport Data.Array.Repa\r\n\r\ndata Stuff = !(Array U DIM1 Double) `With` !Double deriving Show\r\n\r\nthrough :: Maybe Double -> Stuff -> Stuff\r\nm `through` (a `With` _) =\r\n let b = a +^ (negate `smap` sumS (extend (Z :. All :. (1 :: Int)) a))\r\n c = maybe b (const (negate `smap` a)) m in\r\n computeUnboxedS c `With` sumAllS b\r\n\r\nmain :: IO ()\r\nmain = print $ Just 1 `through` (fromListUnboxed (Z :. 1) [1] `With` 1)\r\n}}}\r\n\r\nIt should produce the following result once run.\r\n\r\n{{{#!hs\r\nAUnboxed (Z :. 1) (fromList [-1.0]) `With` 0.0\r\n}}}\r\n\r\nHowever, when built using `repa-3.4.0.1` and compiled with the options\r\n`-O3 -Wall -funfolding-keeness-factor1000 -funfolding-use-threshold1000`,\r\nit crashes as follows.\r\n\r\n{{{#!hs\r\nMain: Oops! Entered absent arg arr2 Array D DIM1 Double\r\n}}}\r\n\r\nAdding `-fno-strictness` to the compiler options or\r\nremoving strictness annotations from the code makes the problem disappear, so\r\nthis looks like a strictness analyzer problem.\r\n\r\nThe libraries used were\r\n\r\n* `QuickCheck-2.8.1`,\r\n* `array-0.5.1.0`,\r\n* `base-4.8.1.0`,\r\n* `bytestring-0.10.6.0`,\r\n* `containers-0.5.6.2`,\r\n* `deepseq-1.4.1.1`,\r\n* `ghc-prim-0.4.0.0`,\r\n* `integer-gmp-1.0.0.0`,\r\n* `pretty-1.1.2.0`,\r\n* `primitive-0.6`,\r\n* `random-1.1`,\r\n* `repa-3.4.0.1`,\r\n* `template-haskell-2.10.0.0`,\r\n* `tf-random-0.5`,\r\n* `time-1.5.0.1`,\r\n* `transformers-0.4.2.0` and\r\n* `vector-0.10.12.3`.","type_of_failure":"OtherFailure","blocking":[]} -->9.0.1Ben GamariBen Gamari