[GHC] #13518: CMM compiles with 8.0.2, fails with git HEAD

GHC ghc-devs at haskell.org
Mon Apr 3 10:44:30 UTC 2017


#13518: CMM compiles with 8.0.2, fails with git HEAD
-------------------------------------+-------------------------------------
           Reporter:  erikd          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.4.1
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Other
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I'm trying to implement `Float` <-> `Word32` bit casts (`Double` <->
 `Word64` works fine) in CMM using:
 {{{
 stg_word32ToFloatzh(I32 w)
 {
     F_ f;
     P_ ptr;

     STK_CHK_GEN_N (FLOAT_STACK_WDS);

     reserve FLOAT_STACK_WDS = ptr {
         I32[ptr] = w;
         f = F_[ptr];
     }

     return (f);
 }

 stg_floatToWord32zh(F_ f)
 {
     I32 w;
     P_ ptr;

     STK_CHK_GEN_N (FLOAT_STACK_WDS);

     reserve FLOAT_STACK_WDS = ptr {
         I32[ptr] = f;
         w = I32[ptr];
     }

     return (w);
 }
 }}}
 This compiles correctly and passes all tests with ghc 8.0.2, but compiling
 the above CMM with git HEAD (currently 1e58efb16f7) results in:
 {{{
 Cmm lint error:
   in basic block cq
     in assignment:
       _cj::I32 = R1;
       Reg ty: I32
       Rhs ty: I64
 Program was:
   {offset
     cq: // global
         _cj::I32 = R1;
         //tick src<rts/CastFloatWord.cmm:(49,1)-(61,1)>
         goto cm;
     cm: // global
         if ((old + 0) - 8 / 8 < SpLim) (likely: False) goto co; else goto
 cp;
     co: // global
         I64[(young<cn> + 8)] = cn;
         call stg_gc_noregs() returns to cn, args: 8, res: 8, upd: 8;
     cn: // global
         goto cm;
     cp: // global
         _cl::P64 = (old + 16);
         //tick src<rts/CastFloatWord.cmm:(55,29)-(58,5)>
         I32[_cl::P64] = _cj::I32;
         _ck::F32 = F32[_cl::P64];
         F1 = _ck::F32;
         call (P64[(old + 8)])(F1) args: 8, res: 0, upd: 8;
   }
 }}}
 ghc 8.0.2 is accepts this code and gives the correct results, so I can
 only assume that git HEAD is incorrect.

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


More information about the ghc-tickets mailing list