#2594: Wrong size for Int in arguments to functions wrapped to FunPtr by FFI
wrappers (on 64-bit machine)
----------------------+-----------------------------------------------------
Reporter: shahn | Owner:
Type: bug | Status: reopened
Priority: normal | Milestone: 6.10.1
Component: Compiler | Version: 6.8.3
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Multiple
Os: Linux |
----------------------+-----------------------------------------------------
Changes (by PaulLiu):
* architecture: x86_64 (amd64) => Multiple
Comment:
This bug affects 32-bit machines too if the callback function is made of
type: `CChar -> IO ()`, and when C function calls it with -1, it would
receive 255 instead.
Functions like `rts_mkInt8, rts_mkInt16`, etc. in `RtsAPI.c` would cast
values into `StgInt` after applying a mask. This mask would definitely
change the sign of negative numbers. So I wonder why the actual callback
into Haskell function would ignore such mask and treat it just like an
ordinary `StgInt` casted back into `Int8, Int16`, etc.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2594#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs