#1471: -ddump-cmm doesn't escape non-ascii/non-printable characters
-----------------------+----------------------------------------------------
Reporter: SamB | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6.1
Severity: normal | Keywords:
Difficulty: Unknown | Os: Unknown
Testcase: | Architecture: Unknown
-----------------------+----------------------------------------------------
For instance, the string literal {{{"\102\232\13\0Hello,
world!\n\178\14\89\179\1\176\4\205\128\49\192\195"}}} came out of ghc
--make -ddump-cmm hell.hs | less looking like:
{{{
cUz_str:
I8[] "fè^M<C0><80>Hello, world!
²^NY³^A°^DÍ<U+0080>1ÀÃ"
}}}
(with LANG=un_US.UTF-8 and a UTF-8 capable terminal; this value gets
passed to unpackCStringUtf8#)
I also have to wonder what the point of using UTF-8 when the original
string literal only contains characters in the range ['0'..'\255'] is...
The full program was:
{{{
#!text/x-haskell
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign.Ptr
import Foreign.C.String
foreign import ccall "dynamic" mkFun :: FunPtr (IO ()) -> IO ()
code :: String
code = "\102\232\13\0Hello,
world!\n\178\14\89\179\1\176\4\205\128\49\192\195"
main :: IO ()
main = withCString code (mkFun . castPtrToFunPtr)
}}}
Note: this doesn't seem to actually work :-(. Oh, right, I'm only setting
the lowest 8 bits of each register. That explains that...
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1471>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs