Ticket #2594 (closed merge: fixed)
Wrong size for Int in arguments to functions wrapped to FunPtr by FFI wrappers (on 64-bit machine)
| Reported by: | shahn | Owned by: | igloo |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.10.1 |
| Component: | Compiler | Version: | 6.8.3 |
| Keywords: | Cc: | ||
| Operating System: | Linux | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

