
#8922: GHC unnecessarily sign/zero-extends C call arguments -------------------------------------+---------------------------------- Reporter: simonmar | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler (NCG) | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: #7684 -------------------------------------+---------------------------------- Comment (by tibbe): Note this exchange in the linked email thread above. I'm not sure if Richard (the editor) is saying that zero extending in the caller is an optimization:
How? You aren't allowed to access the bits outside the specified argument type (which must match on caller and callee side), so you can't observe them, so it's not required to specify their content.
OK, thanks. It's clear now.
The problem is that LLVM assumes that values are extended at a call. GCC does that, but libffi doesn't. So, calls via libffi to LLVM don't work correctly.
It's an optimization to do so to avoid partial register stalls.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8922#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler