Skip to content

Commit 53ec37d

Browse files
external-stg-interpreter: support new decodeDouble_Int64#
This change fixes this compilation error: lib/Stg/Interpreter/PrimOp/Double.hs:126:22: error: [GHC-83865] • Couldn't match expected type ‘Int#’ with actual type ‘Int64#’ • In the first argument of ‘I#’, namely ‘a’ In the first argument of ‘Int64V’, namely ‘(I# a)’ In the expression: Int64V (I# a) | 126 | pure [Int64V (I# a), IntV (I# b)]
1 parent 7a43e9d commit 53ec37d

File tree

1 file changed

+7
-2
lines changed
  • external-stg-interpreter/lib/Stg/Interpreter/PrimOp

1 file changed

+7
-2
lines changed

external-stg-interpreter/lib/Stg/Interpreter/PrimOp/Double.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE RecordWildCards, LambdaCase, OverloadedStrings, PatternSynonyms, MagicHash, UnboxedTuples, BangPatterns, Strict #-}
1+
{-# LANGUAGE RecordWildCards, LambdaCase, OverloadedStrings, PatternSynonyms, MagicHash, UnboxedTuples, BangPatterns, Strict, CPP #-}
22
module Stg.Interpreter.PrimOp.Double where
33

44
import GHC.Word
@@ -123,6 +123,11 @@ evalPrimOp fallback op args t tc = case (op, args) of
123123
( "decodeDouble_Int64#", [DoubleV (D# x)]) -> do
124124
-- NOTE: map back to GHC primop
125125
let !(# a, b #) = decodeDouble_Int64# x
126-
pure [Int64V (I# a), IntV (I# b)]
126+
#if MIN_VERSION_base(4,18,0)
127+
let a' = int64ToInt# a
128+
#else
129+
let a' = a
130+
#endif
131+
pure [Int64V (I# a'), IntV (I# b)]
127132

128133
_ -> fallback op args t tc

0 commit comments

Comments
 (0)