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

GHC ghc-devs at haskell.org
Wed Sep 25 17:29:12 CEST 2013


#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



More information about the ghc-tickets mailing list