[GHC] #7684: cgrun071 segfaults

GHC ghc-devs at haskell.org
Sat Mar 22 17:35:11 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 Johan Tibell <johan.tibell@…>):

 In [changeset:"ad9bf96815cb5a9bb4acc51c99eff20be3e50da3/ghc-prim"]:
 {{{
 #!CommitTicketReference repository="ghc-prim"
 revision="ad9bf96815cb5a9bb4acc51c99eff20be3e50da3"
 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.
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7684#comment:52>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list