[GHC] #10462: GHCi doesn't work Any and missing RealWorld foreign prim imports
GHC
ghc-devs at haskell.org
Fri May 29 21:33:34 UTC 2015
#10462: GHCi doesn't work Any and missing RealWorld foreign prim imports
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 7.10.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Compile-time
Unknown/Multiple | crash
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
Here are two issues with our GHCi support for foreign prim imports:
Here is a program that works:
{{{
{-# LANGUAGE GHCForeignImportPrim, MagicHash, UnliftedFFITypes,
UnboxedTuples #-}
module Serum where
import GHC.Exts
foreign import prim "cheneycopy" cheneycopy :: Word# -> State# RealWorld
-> (# State# RealWorld, Word# #)
}}}
If I remove the world token passing, as in here:
{{{
{-# LANGUAGE GHCForeignImportPrim, MagicHash, UnliftedFFITypes,
UnboxedTuples #-}
module Serum where
import GHC.Exts
foreign import prim "cheneycopy" cheneycopy :: Word# -> Word#
}}}
I get:
{{{
(GHC version 7.10.1 for x86_64-unknown-linux):
ByteCodeGen.generateCCall: missing or invalid World token?
}}}
Another error is if I try to pass Any as an argument:
{{{
{-# LANGUAGE GHCForeignImportPrim, MagicHash, UnliftedFFITypes,
UnboxedTuples #-}
module Serum where
import GHC.Exts
foreign import prim "cheneycopy" cheneycopy :: Any -> State# RealWorld ->
(# State# RealWorld, Word# #)
}}}
Then I get:
{{{
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.1 for x86_64-unknown-linux):
primRepToFFIType
}}}
Note to anyone who is running into this problem: an easy workaround is to
use `-fobject-code` which bypasses bytecode generation.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10462>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list