[GHC] #7684: cgrun071 segfaults
GHC
ghc-devs at haskell.org
Sat Mar 22 14:31:42 UTC 2014
#7684: cgrun071 segfaults
----------------------------------+----------------------------------
Reporter: tibbe | Owner:
Type: bug | Status: infoneeded
Priority: normal | Milestone: 7.8.1
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: MacOS X | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Difficulty: Unknown
Test Case: cgrun071 | Blocked By:
Blocking: | Related Tickets:
----------------------------------+----------------------------------
Comment (by tibbe):
Replying to [comment:42 simonmar]:
> Well, one bug is that in `emitPopCntCall` we don't cast the argument to
the correct width.
I don't think it should.
The `MO_PopCnt` `MachOp` that's emitted by `emitPopCntCall` also takes the
width as an argument. The reason we pass the width all the way down to the
native and LLVM code generators is to avoid doing any narrowing, as we can
emit a `popcnt` instruction that looks at just part of the word (e.g.
`popcnt %ax,%ax`).
If we end up not using the the dedicated instruction, and we're using GCC
4.2 which doesn't do the narrowing correctly, then we'd have to do the
narrowing ourselves before calling the C fallback.
I think we have two choices in working around the buggy behavior of GCC
4.2:
1. Change the function prototype as rwbarton suggested.
2. Do some narrowing in the native code generator before emitting the
call to the C function.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7684#comment:46>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list