From cc7aac1f795f672bc71c155c424d8bd100663ecc Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 20 Aug 2001 14:10:02 +0000 Subject: [PATCH] [project @ 2001-08-20 14:10:02 by simonmar] Remove the in-range assertions on mkMachInt/mkMachWord. They clearly aren't true, because there's nothing stopping you from writing an out-of-range Int# literal (although that's the only way I can see for these to arise). The wider issue is what should be done about out-of-range Int# literals; I vaguely remember that at some point we disallowed them, but I can't find anything in the logs. The case which triggered the assertion, namely "intToWord# 0xffff0000" would appear to be a legitimate use for an out-of-range Int# literal though, given that you can't write Word# literals directly. --- ghc/compiler/basicTypes/Literal.lhs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/basicTypes/Literal.lhs b/ghc/compiler/basicTypes/Literal.lhs index 03101e3..3555d31 100644 --- a/ghc/compiler/basicTypes/Literal.lhs +++ b/ghc/compiler/basicTypes/Literal.lhs @@ -146,10 +146,13 @@ instance Ord Literal where \begin{code} mkMachInt, mkMachWord, mkMachInt64, mkMachWord64 :: Integer -> Literal -mkMachInt x = ASSERT2( inIntRange x, integer x ) MachInt x -mkMachWord x = ASSERT2( inWordRange x, integer x ) MachWord x -mkMachInt64 x = MachInt64 x -- Assertions? -mkMachWord64 x = MachWord64 x -- Ditto? +mkMachInt x = -- ASSERT2( inIntRange x, integer x ) + -- not true: you can write out of range Int# literals + MachInt x +mkMachWord x = -- ASSERT2( inWordRange x, integer x ) + MachWord x +mkMachInt64 x = MachInt64 x +mkMachWord64 x = MachWord64 x inIntRange, inWordRange :: Integer -> Bool inIntRange x = x >= tARGET_MIN_INT && x <= tARGET_MAX_INT -- 1.7.10.4