Skip to content
Snippets Groups Projects
Commit 84d7b7dd authored by rwbarton's avatar rwbarton Committed by Austin Seipp
Browse files

Make argument types in popcnt.c match declared primop types

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.

(cherry picked from commit ad9bf968)
parent ac633f2b
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment