[GHC] #3971: ghc-pkg list segfaults in ghc-6.12.1.20100330
GHC
cvs-ghc at haskell.org
Sat Apr 10 17:42:44 EDT 2010
#3971: ghc-pkg list segfaults in ghc-6.12.1.20100330
---------------------------+------------------------------------------------
Reporter: wkahl | Owner:
Type: bug | Status: new
Priority: normal | Component: Package system
Version: 6.12.1 RC1 | Keywords:
Os: Linux | Testcase:
Architecture: powerpc | Failure: None/Unknown
---------------------------+------------------------------------------------
Comment(by judahj):
Ok, the problem is happening with a FFI "wrapper" function. I suspect
that this is an issue with GHC's PowerPC support, rather than with the
terminfo package itself. There's another good example at
http://www.haskell.org/haskellwiki/GHC/Using_the_FFI ; can you verify
whether it works?
For reference, this is the relevant code from the test script:
{{{
foreign import ccall "wrapper" mkCallback :: CharOutput -> IO (FunPtr
CharOutput)
foreign import ccall tputs :: CString -> CInt -> FunPtr CharOutput -> IO
()
type CharOutput = CInt -> IO CInt
...
tPuts :: String -> IO ()
tPuts s = do
withCString s $ \c_str -> do
putStrLn "Making the callback function"
putc_ptr <- mkCallback putc
putStrLn "Callback created."
tputs c_str 1 putc_ptr
putStrLn "Called tputs."
freeHaskellFunPtr putc_ptr
putStrLn "Freed callback."
where
putc c = do
print ("Outputting:",c,toEnum (fromEnum c)::Char)
return c
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3971#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list