#4992: LLVM trashes registers for primitive calls
--------------------------------+-------------------------------------------
    Reporter:  scpmw            |        Owner:  davidterei@…        
        Type:  bug              |       Status:  patch               
    Priority:  normal           |    Milestone:                      
   Component:  Compiler (LLVM)  |      Version:  7.1                 
    Keywords:                   |     Testcase:                      
   Blockedby:                   |   Difficulty:                      
          Os:  Linux            |     Blocking:                      
Architecture:  x86_64 (amd64)   |      Failure:  Runtime crash       
--------------------------------+-------------------------------------------

Comment(by scpmw):

 I have attached my best shot at reproducing the problem with just "tan".
 It generates roughly the following code before the patch:

 {{{
         subq    $72, %rsp
         movq    %r15, 40(%rsp)          # 8-byte Spill
         movq    %r14, 32(%rsp)          # 8-byte Spill
         movq    %r12, 24(%rsp)          # 8-byte Spill
         movq    %rbp, 8(%rsp)           # 8-byte Spill
         movq    %r13, 16(%rsp)          # 8-byte Spill
         movaps  %xmm5, %xmm0
         callq   tan
         cvttsd2siq      %xmm0, %rax
         movq    %rax, 56(%rsp)          # 8-byte Spill
 }}}

 And then goes on using all available registers, which is clearly
 dangerous. With the patch applied, a lot more registers are saved on top
 of the stack.

 I'm unsure though how to craft an actually failing program out of this.
 Maybe somebody with a better overview can put in the missing piece?

 (Fun fact: The program actually manages to crash the LLVM optimizer both
 with and without the patch. Compiling without -O works.)

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to