X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FcoreSyn%2FMkExternalCore.lhs;h=3e8a9896e45fdbbe4a53c63c06811ef9394593d8;hp=244144c22d51baadd325c04540024a0682033fa4;hb=5d1ba397950bd700768933cc573f04a804f6e32a;hpb=35549002886ef843f80cb265a8f14d7f9522d85d diff --git a/compiler/coreSyn/MkExternalCore.lhs b/compiler/coreSyn/MkExternalCore.lhs index 244144c..3e8a989 100644 --- a/compiler/coreSyn/MkExternalCore.lhs +++ b/compiler/coreSyn/MkExternalCore.lhs @@ -32,6 +32,8 @@ import StaticFlags import IO import FastString +import Data.Char + emitExternalCore :: DynFlags -> NameSet -> CgGuts -> IO () emitExternalCore dflags exports cg_guts | opt_EmitExternalCore @@ -160,7 +162,12 @@ make_alt a@(DEFAULT,_ ,_) = pprPanic ("MkExternalCore: make_alt: DEFAULT " make_lit :: Literal -> C.Lit make_lit l = case l of - MachChar i -> C.Lchar i t + -- Note that we need to check whether the character is "big". + -- External Core only allows character literals up to '\xff'. + MachChar i | i <= chr 0xff -> C.Lchar i t + -- For a character bigger than 0xff, we represent it in ext-core + -- as an int lit with a char type. + MachChar i -> C.Lint (fromIntegral $ ord i) t MachStr s -> C.Lstring (unpackFS s) t MachNullAddr -> C.Lint 0 t MachInt i -> C.Lint i t