#2926: Foreign exported function returns wrong type
---------------------------------+------------------------------------------
Reporter: fasta | Owner:
Type: bug | Status: new
Priority: low | Milestone: _|_
Component: Compiler (FFI) | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Changes (by simonmar):
* priority: normal => low
* milestone: => _|_
Comment:
Oh, I see.
In fact `HsInt32` happens to be `long` on x86, so gcc warns about its use
with the `%d` format in printf, even though on this architecture `long` is
the same size as `int`. gcc is complaining about a portability problem,
but we know there isn't one. In almost every other way, `HsInt32` is
interchangeable with `int`.
We could make `HsInt32` the same as `int`, but then the exact same problem
would crop up with `CLong`.
Sigh. It's a pain to make GHC emit a real `int` here, because GHC doesn't
know anything special about the `CInt` type, as far as GHC is concerned
it's just a newtype of `Int32` (or whatever).
I'm making this bug low prio, because there are easy workarounds and it's
hard to fix.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2926#comment:2>
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