[commit: ghc] master: hopefully fix #7620 (b91f3d2)
Simon Marlow
marlowsd at gmail.com
Tue Jan 29 11:12:35 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/b91f3d260f3ccb57e8fcd61f943c6fadf26391c8
>---------------------------------------------------------------
commit b91f3d260f3ccb57e8fcd61f943c6fadf26391c8
Author: Simon Marlow <marlowsd at gmail.com>
Date: Mon Jan 28 10:04:34 2013 +0000
hopefully fix #7620
>---------------------------------------------------------------
compiler/cmm/PprC.hs | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index bcfb5dc..45f46b8 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -358,10 +358,13 @@ pprExpr e = case e of
CmmRegOff reg 0 -> pprCastReg reg
CmmRegOff reg i
- | i > 0 -> pprRegOff (char '+') i
- | otherwise -> pprRegOff (char '-') (-i)
+ | i < 0 && negate_ok -> pprRegOff (char '-') (-i)
+ | otherwise -> pprRegOff (char '+') i
where
pprRegOff op i' = pprCastReg reg <> op <> int i'
+ negate_ok = negate (fromIntegral i :: Integer) <
+ fromIntegral (maxBound::Int)
+ -- overflow is undefined; see #7620
CmmMachOp mop args -> pprMachOpApp mop args
More information about the ghc-commits
mailing list