-
Notifications
You must be signed in to change notification settings - Fork 144
Closed
Description
See #392 for discovery.
By reducing test case to, which can be built with master
:
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Test.Tasty (defaultMain, testGroup)
import Test.Tasty.HUnit (testCase, (@=?))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
main :: IO ()
main = defaultMain $ testGroup "bytestring-th"
[ testGroup "lazy"
[ testCase "binary" $ do
let bs :: LBS.ByteString
bs = "\0\1"
bs @=? LBS.pack [0,1]
]
]
The Core with GHC-9.0.1 has terms:
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
lvl1_r5QU :: ghc-prim-0.7.0:GHC.Prim.Addr#
[GblId, Unf=OtherCon []]
lvl1_r5QU = "\\128\SOH"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
lvl2_r5QV :: [Char]
[GblId]
lvl2_r5QV = ghc-prim-0.7.0:GHC.CString.unpackCStringUtf8# lvl1_r5QU
ghci> unpackCStringUtf8# "\128\SOH"#
"\-4223"
ghci> (-4223) `mod` 256
129
which explain where from 129 comes from. But how those Core terms are generated, I don't know.
This happens with GHC-9.0 and GHC-9.2.0.20210422, but doesn't with GHC-8.x
cc @bgamari
Metadata
Metadata
Assignees
Labels
No labels