[GHC] #9920: Segfault in arm binary

GHC ghc-devs at haskell.org
Tue Dec 23 05:13:19 UTC 2014


#9920: Segfault in arm binary
-------------------------------------------+---------------------------
              Reporter:  erikd             |            Owner:
                  Type:  bug               |           Status:  new
              Priority:  normal            |        Milestone:
             Component:  Compiler          |          Version:  7.11
            Resolution:                    |         Keywords:
      Operating System:  Unknown/Multiple  |     Architecture:  arm
       Type of failure:  Runtime crash     |       Difficulty:  Unknown
             Test Case:                    |       Blocked By:
              Blocking:                    |  Related Tickets:
Differential Revisions:                    |
-------------------------------------------+---------------------------
Changes (by erikd):

 * cc: bgamari, rwbarton (added)


Comment:

 Captured the various tmp files when compiling `rts/StgStartup.cmm`. The
 disassembled llvm byte code for `stg_init_finish` and `stg_init` look like
 this:

 {{{
 ; Function Attrs: nounwind
 define cc10 void @"stg_init_finish$def"(i32* noalias nocapture %Base_Arg
                 , i32* noalias nocapture %Sp_Arg, i32* noalias nocapture
 %Hp_Arg
                 , i32 %R1_Arg, i32 %R2_Arg, i32 %R3_Arg
                 , i32 %R4_Arg, i32 %SpLim_Arg) #0 align 4 {
 cF:
   tail call cc10 void bitcast (i8* @StgReturn to void
                    (i32*, i32*, i32*, i32, i32, i32, i32, i32)*)(i32*
 %Base_Arg
                    , i32* %Sp_Arg, i32* %Hp_Arg, i32 %R1_Arg, i32 undef
                    , i32 undef, i32 undef, i32 %SpLim_Arg) #0
   ret void
 }

 ; Function Attrs: nounwind
 define cc10 void @"stg_init$def"(i32* noalias nocapture %Base_Arg
                 , i32* noalias nocapture readnone %Sp_Arg
                 , i32* noalias nocapture %Hp_Arg, i32 %R1_Arg, i32 %R2_Arg
                 , i32 %R3_Arg, i32 %R4_Arg, i32 %SpLim_Arg) #0 align 4 {
 cH:
   %ln5z = getelementptr inbounds i32* %Base_Arg, i32 198

 ....
 }}}


 which is fine, but when that gets run through `llc` we get the following
 assembly code:

 {{{
         .text
         .globl  stg_init_finish$def
         .align  2
         .type   stg_init_finish$def,%function
 stg_init_finish$def:                    @ @"stg_init_finish$def"
         .fnstart
 .Leh_func_begin7:
 @ BB#0:                                 @ %cF

 .Ltmp7:
         .size   stg_init_finish$def, .Ltmp7-stg_init_finish$def
         .cantunwind
         .fnend

         .globl  stg_init$def
         .align  2
         .type   stg_init$def,%function
 stg_init$def:                           @ @"stg_init$def"
         .fnstart
 .Leh_func_begin8:
 @ BB#0:                                 @ %cH
         ldr     r5, [r4, #792]
         ldr     r0, [r5], #4

 .Ltmp8:
         .size   stg_init$def, .Ltmp8-stg_init$def
         .cantunwind
         .fnend
 }}}

 For some reason `llc` is dropping the actual body of the function
 `stg_init_finish`.

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


More information about the ghc-tickets mailing list