From: simonmar Date: Thu, 23 Jun 2005 09:17:30 +0000 (+0000) Subject: [project @ 2005-06-23 09:17:30 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~412 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=4e448ebd74a49ad0f6e22249f7d81086b02484d4;p=ghc-hetmet.git [project @ 2005-06-23 09:17:30 by simonmar] Add a 'U' suffix to all integer literals to make them explicitly unsigned. This avoids some warnings from gcc, but I don't think it fixes any actual bugs (I could be wrong, though). --- diff --git a/ghc/compiler/cmm/PprC.hs b/ghc/compiler/cmm/PprC.hs index 72a3cb1..9c494fe 100644 --- a/ghc/compiler/cmm/PprC.hs +++ b/ghc/compiler/cmm/PprC.hs @@ -992,11 +992,16 @@ pprHexVal w rep | otherwise = ptext SLIT("0x") <> go w <> repsuffix rep where -- type suffix for literals: - -- on 32-bit platforms, add "LL" to 64-bit literals - repsuffix I64 | wORD_SIZE == 4 = ptext SLIT("LL") + -- Integer literals are unsigned in Cmm/C. We explicitly cast to + -- signed values for doing signed operations, but at all other + -- times values are unsigned. This also helps eliminate occasional + -- warnings about integer overflow from gcc. + + -- on 32-bit platforms, add "ULL" to 64-bit literals + repsuffix I64 | wORD_SIZE == 4 = ptext SLIT("ULL") -- on 64-bit platforms with 32-bit int, add "L" to 64-bit literals - repsuffix I64 | cINT_SIZE == 4 = ptext SLIT("L") - repsuffix _ = empty + repsuffix I64 | cINT_SIZE == 4 = ptext SLIT("UL") + repsuffix _ = char 'U' go 0 = empty go w' = go q <> dig