[GHC] #7684: cgrun071 segfaults

GHC ghc-devs at haskell.org
Sat Sep 7 01:09:48 CEST 2013


#7684: cgrun071 segfaults
----------------------------------+----------------------------------
        Reporter:  tibbe          |            Owner:
            Type:  bug            |           Status:  new
        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 rwbarton):

 In the #7383 "promote arguments" patch, shouldn't the new line 2060 read

 {{{
     let prom_args = map (maybePromoteCArg dflags W64 {- not W32 -}) args
 }}}

 But anyways, I can't see why the code generator would think the argument
 of the `MO_PopCnt W8` operation is an 8-bit quantity—it comes from a
 Haskell `Word#`, and the type of the `popCnt8#` primop is `Word# ->
 Word#`.  So we shouldn't expect the "promote arguments" patch to do
 anything here.

 Can't we just fix this by changing the definition of `hs_popcnt8` from
 {{{
 extern StgWord hs_popcnt8(StgWord8 x);
 StgWord
 hs_popcnt8(StgWord8 x)
 {
   return popcount_tab[(unsigned char)x];
 }
 }}}
 to
 {{{
 extern StgWord hs_popcnt8(StgWord x);
 StgWord
 hs_popcnt8(StgWord x)
 {
   return popcount_tab[(unsigned char)x];
 }
 }}}
 (and the same for hs_popcnt16, etc.)—then everybody will think that the
 argument to `hs_popcnt8` is a word rather than a single byte, and gcc 4.2
 will be forced to output the same code as gcc 4.8.

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




More information about the ghc-tickets mailing list