[GHC] #8355: Core lint error/warnings with `primitive-0.5.1.0`

#8355: Core lint error/warnings with `primitive-0.5.1.0` ----------------------------+---------------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects valid program Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | ----------------------------+---------------------------------------------- When compiling [http://hackage.haskell.org/package/primitive-0.5.1.0 primitive-0.5.1.0] with `--ghc-option=-dcore-lint`, GHC 7.4.2 just emits a single warning: {{{ [10 of 10] Compiling Data.Primitive.MutVar ( Data/Primitive/MutVar.hs, dist/build/Data/Primitive/MutVar.o ) *** Core Lint warnings : in result of Desugar (after optimization) *** <no location info>: [RHS of $c/=_a724 :: forall s_a70h a_a70i. Data.Primitive.MutVar.MutVar s_a70h a_a70i -> Data.Primitive.MutVar.MutVar s_a70h a_a70i -> GHC.Types.Bool] INLINE binder is (non-rule) loop breaker: $c/=_a724 }}} However, with GHC 7.6.3, an error is produced: {{{ [ 5 of 10] Compiling Data.Primitive.Types ( Data/Primitive/Types.hs, dist/build/Data/Primitive/Types.o ) *** Core Lint errors : in result of Desugar (after optimization) *** <no location info>: Warning: In the type `GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO)' Kind application error in type `GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO)' Function kind = forall (k_1c :: BOX). k_1c -> k_1c -> Constraint Arg kinds = [(*, BOX), (GHC.Prim.State# GHC.Prim.RealWorld, #), (GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO), #)] <no location info>: Warning: In the type `GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO)' Kind application error in type `GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO)' Function kind = forall (k_1c :: BOX). k_1c -> k_1c -> Constraint Arg kinds = [(*, BOX), (GHC.Prim.State# GHC.Prim.RealWorld, #), (GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO), #)] {-# LINE 142 "Data/Primitive/Types.hs #-}: Warning: [RHS of cobox_a2gR :: GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO)] The type of this binder doesn't match the type of its RHS: cobox_a2gR Binder's type: GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO) Rhs type: GHC.Prim.State# GHC.Prim.RealWorld ~ GHC.Prim.State# (Control.Monad.Primitive.PrimState GHC.Types.IO) }}} The core-lint error persists in GHC HEAD/7.7, blocking us from updating GHC's in-tree `primitive`/`vector` packages. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8355 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8355: Core lint error/warnings with `primitive-0.5.1.0` ----------------------------------------------+---------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ----------------------------------------------+---------------------------- Comment (by monoidal): See #7643. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8355#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8355: Core lint error/warnings with `primitive-0.5.1.0` ----------------------------------------------+---------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ----------------------------------------------+---------------------------- Comment (by hvr): The workaround described in #7643 seems to work w/ GHC 7.6.3 and GHC HEAD, that is: {{{#!diff diff --git a/Data/Primitive/Types.hs b/Data/Primitive/Types.hs index ffd2cb4..cfe242c 100644 --- a/Data/Primitive/Types.hs +++ b/Data/Primitive/Types.hs @@ -114,16 +114,16 @@ instance Prim ty where { \ { (# s1#, x# #) -> (# s1#, ctr x# #) } \ ; writeByteArray# arr# i# (ctr x#) s# = wr_arr arr# i# x# s# \ ; setByteArray# arr# i# n# (ctr x#) s# \ - = case internal (set_arr arr# i# n# x#) (unsafeCoerce# s#) of \ - { (# s1#, _ #) -> unsafeCoerce# s1# } \ + = case unsafeCoerce# (internal (set_arr arr# i# n# x#)) s# of \ + { (# s1#, _ #) -> s1# } \ \ ; indexOffAddr# addr# i# = ctr (idx_addr addr# i#) \ ; readOffAddr# addr# i# s# = case rd_addr addr# i# s# of \ { (# s1#, x# #) -> (# s1#, ctr x# #) } \ ; writeOffAddr# addr# i# (ctr x#) s# = wr_addr addr# i# x# s# \ ; setOffAddr# addr# i# n# (ctr x#) s# \ - = case internal (set_addr addr# i# n# x#) (unsafeCoerce# s#) of \ - { (# s1#, _ #) -> unsafeCoerce# s1# } \ + = case unsafeCoerce# (internal (set_addr addr# i# n# x#)) s# of \ + { (# s1#, _ #) -> s1# } \ ; {-# INLINE sizeOf# #-} \ ; {-# INLINE alignment# #-} \ ; {-# INLINE indexByteArray# #-} \ }}} I'll run a few tests and validate; if that works out I'll file a pull- request at http://github.com/haskell/primitive -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8355#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8355: Core lint error/warnings with `primitive-0.5.1.0` ----------------------------------------------+---------------------------- Reporter: hvr | Owner: Type: bug | Status: closed Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects valid program | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: #7643 ----------------------------------------------+---------------------------- Changes (by hvr): * status: new => closed * resolution: => duplicate * related: => #7643 Comment: Actually a duplicate of #7643 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8355#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8355: Core lint error/warnings with `primitive-0.5.1.0`
----------------------------------------------+----------------------------
Reporter: hvr | Owner:
Type: bug | Status: closed
Priority: highest | Milestone: 7.8.1
Component: Compiler | Version: 7.6.3
Resolution: duplicate | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects valid program | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets: #7643
----------------------------------------------+----------------------------
Comment (by Herbert Valerio Riedel
participants (1)
-
GHC