#7506: adding extra arguments to a foreign import statement can cause ghc to 
panic
------------------------------------+---------------------------------------
  Reporter:  jwlato                 |          Owner:                  
      Type:  bug                    |         Status:  closed          
  Priority:  normal                 |      Milestone:                  
 Component:  Compiler (FFI)         |        Version:  7.6.1           
Resolution:  fixed                  |       Keywords:                  
        Os:  Unknown/Multiple       |   Architecture:  Unknown/Multiple
   Failure:  Compile-time crash     |     Difficulty:  Unknown         
  Testcase:  ffi/should_fail/T7506  |      Blockedby:                  
  Blocking:                         |        Related:                  
------------------------------------+---------------------------------------
Changes (by simonpj):

  * status:  new => closed
  * difficulty:  => Unknown
  * resolution:  => fixed
  * testcase:  => ffi/should_fail/T7506


Comment:

 The problem here is simply that a foreign import with a "&" should not
 have an arrow in its type.  See the
 [http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi/ffise4.html#x7-150004
 FFI spec].

 GHC should not crash though. Now it says
 {{{
 T7506.hs:6:1:
     Unacceptable type in foreign declaration: Int -> IO ()
     A foreign-imported address (via &foo) must have type (Ptr a) or
 (FunPtr a)
     When checking declaration:
       foreign import ccall safe "static stdio.h &putchar" c_putchar
         :: Int -> IO ()
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7506#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to