|
[GHC] #746: ghc panic! with foreign import wrapper involving Bool: msg#00037lang.haskell.glasgow.bugs
#746: ghc panic! with foreign import wrapper involving Bool ------------------------------------+--------------------------------------- Reporter: brianh@xxxxxxxxxxxx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 6.4 Severity: normal | Keywords: DsForeign Bool FFI Os: Windows | Difficulty: Unknown Architecture: x86 | ------------------------------------+--------------------------------------- I encounter a strange 'ghc panic' bug when I try to export the function onKeyDown below. I'm using ghc 6.4 and WindowsXP on x86. The bug seems to be caused by the use of {{{Bool}}} in {{{DumaKeyCallback}}}, because when I change the {{{Bool}}} to an {{{Int}}} everything compiles ok. Therefore I wonder if this is something to do with the compilation of "wrapper" imports not liking a Bool in the type signature? Anyway here is the full standalone example and session transcript: {{{ module Keyboard ( Key(..) , KeyCallback , onKeyDown -- compiles fine if this export is commented out ) where import Foreign.Ptr data Key = KeyLButton -- other keys ommitted | KeyDown deriving (Enum) type KeyCallback = Key -> IO () type DumaKeyCallback = Bool -> Int -> IO () -- Crashes GHC -- type DumaKeyCallback = Int -> Int -> IO () -- But this compiles fine!!!! ? foreign import ccall "wrapper" mkDumaKeyCallback :: DumaKeyCallback -> IO (FunPtr DumaKeyCallback) toDumaKeyCallback :: KeyCallback -> DumaKeyCallback toDumaKeyCallback f = \alt key -> f (toEnum key) foreign import ccall duma_onKeyDown :: FunPtr DumaKeyCallback -> IO () onKeyDown :: KeyCallback -> IO () onKeyDown f = mkDumaKeyCallback (toDumaKeyCallback f) >>= duma_onKeyDown }}} Transcript: {{{ >ghc -fglasgow-exts -fffi -v keyboard.hs Glasgow Haskell Compiler, Version 6.4, for Haskell 98, compiled by GHC version 6.2.2 Using package config file: c:\ghc\ghc-6.4\package.conf Hsc static flags: -static *** Checking old interface for Keyboard: *** Parser: *** Renamer/typechecker: *** Desugar: Result size = 354 *** Simplify: Result size = 528 Result size = 443 Result size = 415 *** Tidy Core: Result size = 415 *** CorePrep: Result size = 500 *** Stg2Stg: *** CodeGen: *** CodeOutput: *** Deleting temp files Deleting: C:/DOCUME~1/TYPHON~1/LOCALS~1/Temp/ghc4084.s Warning: deleting non-existent C:/DOCUME~1/TYPHON~1/LOCALS~1/Temp/ghc4084.s ghc: panic! (the `impossible' happened, GHC version 6.4): DsForeign.getPrimTyOf GHCziBase.Bool{(w) tc 3c} Please report it as a compiler bug to glasgow-haskell-bugs@xxxxxxxxxxx, or http://sourceforge.net/projects/ghc/. }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/746> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler_______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Template Haskell, Simon Peyton-Jones |
|---|---|
| Next by Date: | [GHC] #747: Unloading a dll does not clean up properly, GHC |
| Previous by Thread: | RE: Template Haskell, Simon Peyton-Jones |
| Next by Thread: | Re: [GHC] #746: ghc panic! with foreign import wrapper involving Bool, GHC |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |