summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap.hs2
-rw-r--r--libraries/ghc-heap/GHC/Exts/Heap/Closures.hs2
-rw-r--r--libraries/ghc-heap/tests/heap_all.hs5
3 files changed, 5 insertions, 4 deletions
diff --git a/libraries/ghc-heap/GHC/Exts/Heap.hs b/libraries/ghc-heap/GHC/Exts/Heap.hs
index ac954bba8b..2652515af9 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap.hs
@@ -120,7 +120,7 @@ instance Word64# ~ a => HasHeapRep (a :: TYPE 'Word64Rep) where
instance Addr# ~ a => HasHeapRep (a :: TYPE 'AddrRep) where
getClosureData x = return $
- AddrClosure { ptipe = PAddr, addrVal = I# (unsafeCoerce# x) }
+ AddrClosure { ptipe = PAddr, addrVal = Ptr x }
instance Float# ~ a => HasHeapRep (a :: TYPE 'FloatRep) where
getClosureData x = return $
diff --git a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
index 6078a927bf..a65eb9cbed 100644
--- a/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
+++ b/libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
@@ -329,7 +329,7 @@ data GenClosure b
-- | Primitive Addr
| AddrClosure
{ ptipe :: PrimType
- , addrVal :: !Int }
+ , addrVal :: !(Ptr ()) }
-- | Primitive Float
| FloatClosure
diff --git a/libraries/ghc-heap/tests/heap_all.hs b/libraries/ghc-heap/tests/heap_all.hs
index ac8953b5d2..482b424283 100644
--- a/libraries/ghc-heap/tests/heap_all.hs
+++ b/libraries/ghc-heap/tests/heap_all.hs
@@ -12,6 +12,7 @@ import GHC.Int
import GHC.IO
import GHC.IORef
import GHC.MVar
+import GHC.Ptr
import GHC.Stack
import GHC.STRef
import GHC.Weak
@@ -176,7 +177,7 @@ exWord64Closure = Word64Closure
exAddrClosure :: Closure
exAddrClosure = AddrClosure
- { ptipe = PAddr, addrVal = 42 }
+ { ptipe = PAddr, addrVal = nullPtr `plusPtr` 42 }
exFloatClosure :: Closure
exFloatClosure = FloatClosure
@@ -328,7 +329,7 @@ main = do
-- assertClosuresEq exWord64Closure
-- Primitive Addr
- let v = unsafeCoerce# 42# :: Addr#
+ let (Ptr v) = nullPtr `plusPtr` 42
getClosureData v >>=
assertClosuresEq exAddrClosure