[project @ 1999-06-23 15:30:59 by simonmar]
authorsimonmar <unknown>
Wed, 23 Jun 1999 15:30:59 +0000 (15:30 +0000)
committersimonmar <unknown>
Wed, 23 Jun 1999 15:30:59 +0000 (15:30 +0000)
print minInt as (mintInt+1)-1, to avoid gcc's conversion to unsigned.

ghc/compiler/basicTypes/Const.lhs

index 7348a0d..2c2fbb4 100644 (file)
@@ -346,8 +346,12 @@ pprLit lit
                                                        <+> ppr range_max)])
                        -- in interface files, parenthesize raw negative ints.
                        -- this avoids problems like {-1} being interpreted
-                       -- as a comment starter.
+                       -- as a comment starter. -}
                       | ifaceStyle sty && i < 0 -> parens (integer i)
+                       -- avoid a problem whereby gcc interprets the constant
+                       -- minInt as unsigned.
+                      | code_style && i == (toInteger (minBound :: Int))
+                               -> parens (hcat [integer (i+1), text "-1"])
                       | otherwise -> integer i
 
                       where