[GHC] #8834: 64-bit windows cabal.exe segfaults in GC

GHC ghc-devs at haskell.org
Thu Mar 13 15:27:33 UTC 2014


#8834: 64-bit windows cabal.exe segfaults in GC
----------------------------------+----------------------------------
        Reporter:  awson          |            Owner:
            Type:  bug            |           Status:  patch
        Priority:  highest        |        Milestone:  7.8.1
       Component:  Compiler       |          Version:  7.8.1-rc2
      Resolution:                 |         Keywords:
Operating System:  Windows        |     Architecture:  x86_64 (amd64)
 Type of failure:  Runtime crash  |       Difficulty:  Unknown
       Test Case:                 |       Blocked By:
        Blocking:                 |  Related Tickets:
----------------------------------+----------------------------------

Comment (by simonmar):

 Here is the broken bit of code, from `lines1_bad`:

 {{{
   c2gC:
       _s2cV::I64 = R5;
       _s2cY::I64 = R2 + R4;
       _c2f5::I64 = R5;
       (_s2d3::I64) = call "ccall" arg hints:  [PtrHint,
                                                `signed',]  result hints:
 [PtrHint] memchr(_s2cY::I64, 10, _c2f5::I64);
       if (_s2d3::I64 == 0) goto c2gK; else goto c2gL;
   c2gK:
       call MO_Touch(R3);
       I64[Hp - 128] = Data.ByteString.Internal.PS_con_info;
       P64[Hp - 120] = R3;
       I64[Hp - 112] = R2;
       I64[Hp - 104] = R4;
       I64[Hp - 96] = _s2cV::I64;
       I64[Hp - 88] = :_con_info;
       P64[Hp - 80] = Hp - 127;
       P64[Hp - 72] = GHC.Types.[]_closure+1;
       _c2gw::P64 = Hp - 86;
       Hp = Hp - 72;
       R1 = _c2gw::P64;
       call (P64[Sp])(R1) args: 8, res: 0, upd: 8;
 }}}

 Note how R2, R3 and R4 are live across the C call.  This is wrong, because
 on Win64, R3 and R4 are caller-saves and therefore clobbered by the C
 call.

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


More information about the ghc-tickets mailing list