Skip to content
Snippets Groups Projects
Reid Barton's avatar
rwbarton authored
On 64-bit Mac OS, gcc 4.2 (which comes with Xcode 4.6) generates code
that assumes that an argument that is smaller than the register
it is passed in has been sign- or zero-extended. But ghc thinks
the types of the PopCnt*Op primops are Word# -> Word#, so it passes
the entire argument word to the hs_popcnt* function as though it was
declared to have an argument of type StgWord. Segfaults ensue.

The easiest fix is to sidestep all this zero-extension business
by declaring the hs_popcnt* functions to take a whole StgWord (when their
argument would fit in a register), thereby matching the list of primops.

Fixes #7684.
ad9bf968
History
Name Last commit Last update
GHC
cbits
tests
.gitignore
LICENSE
Setup.hs
ghc-prim.cabal