[GHC] #2594: Wrong size for Int in arguments to functions wrapped
to FunPtr by FFI wrappers (on 64-bit machine)
GHC
trac at galois.com
Sat Sep 13 19:07:32 EDT 2008
#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: new
Priority: normal | Component: Compiler
Version: 6.8.3 | Severity: normal
Keywords: | Testcase:
Architecture: x86_64 (amd64) | Os: Linux
-------------------------------+--------------------------------------------
An operation
{{{
foo :: Int -> IO ()
}}}
is wrapped to a function pointer {{{ptr :: FunPtr (Int -> IO ())}}} (via
an FFI wrapper). If you pass this pointer to a C function, that calls it
with a negative parameter (e.g. -1), the operation is executed with a
positive parameter (something near
{{{4294967295 ( == 2 ^ 32 - 1)}}}).
This works correctly on x86 (32-bit).
See attachment for an example.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2594>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list