[GHC] #3546: Use of float type in unregistered build freezes program

GHC trac at galois.com
Mon Sep 28 09:56:53 EDT 2009


#3546: Use of float type in unregistered build freezes program
-------------------------------------------+--------------------------------
    Reporter:  dterei                      |        Owner:  igloo           
        Type:  merge                       |       Status:  new             
    Priority:  high                        |    Milestone:  6.12.1          
   Component:  Compiler                    |      Version:                  
    Severity:  critical                    |   Resolution:                  
    Keywords:  float unregistered freezes  |   Difficulty:  Unknown         
    Testcase:  arith006                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |  
-------------------------------------------+--------------------------------
Changes (by simonmar):

  * owner:  simonmar => igloo
  * type:  bug => merge

Comment:

 Fixed (nice bug!)

 {{{
 Mon Sep 28 05:44:55 PDT 2009  Simon Marlow <marlowsd at gmail.com>
   * emitRetUT: cope with arguments overlapping with results (#3546)

   In decodeFloat_Int# we have the C-- code:

       mp_tmp1  = Sp - WDS(1);
       mp_tmp_w = Sp - WDS(2);

       /* arguments: F1 = Float# */
       arg = F1;

       /* Perform the operation */
       foreign "C" __decodeFloat_Int(mp_tmp1 "ptr", mp_tmp_w "ptr", arg)
 [];

       /* returns: (Int# (mantissa), Int# (exponent)) */
       RET_NN(W_[mp_tmp1], W_[mp_tmp_w]);

   Which all looks quite reasonable.  The problem is that RET_NN() might
   assign the results to the stack (with an unregisterised back end), and
   in this case the arguments to RET_NN() refer to the same stack slots
   that will be assigned to.

   The code generator should do the right thing here, but it wasn't - it
   was assuming that it could assign the results sequentially.  A 1-line
   fix to use emitSimultaneously rather than emitStmts (plus comments).
 }}}

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


More information about the Glasgow-haskell-bugs mailing list