[GHC] #9274: GHC panic with UnliftedFFITypes+CApiFFI

GHC ghc-devs at haskell.org
Sun Jul 6 11:44:11 UTC 2014


#9274: GHC panic with UnliftedFFITypes+CApiFFI
-----------------------------------+---------------------------------------
       Reporter:  hvr              |             Owner:
           Type:  bug              |            Status:  new
       Priority:  normal           |         Milestone:  7.10.1
      Component:  Compiler         |           Version:  7.6.3
       Keywords:                   |  Operating System:  Unknown/Multiple
   Architecture:                   |   Type of failure:  Compile-time crash
  Unknown/Multiple                 |         Test Case:
     Difficulty:  Unknown          |          Blocking:
     Blocked By:                   |
Related Tickets:                   |
-----------------------------------+---------------------------------------
 The following code fails to compile with at least GHC 7.6, 7.8 and HEAD:

 {{{#!hs
 import GHC.Prim
 import Foreign.C

 type GmpLimb = CULong
 type GmpSize = CLong

 -- mp_limb_t mpn_add_1 (mp_limb_t *rp, const mp_limb_t *s1p, mp_size_t n,
 mp_limb_t s2limb)

 foreign import capi unsafe "gmp.h mpn_add_1"
   c_mpn_add_1 :: MutableByteArray# s -> ByteArray# -> GmpSize -> GmpLimb
 -> IO GmpLimb
 }}}

 with the following compile error message:

 {{{
 ghc: panic! (the 'impossible' happened)
   (GHC version 7.9.20140704 for x86_64-unknown-linux):
         toCType MutableByteArray# s

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

 Otoh, replacing `capi` with `ccall` makes the code compile just fine

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9274>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list