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

GHC ghc-devs at haskell.org
Mon Apr 3 21:23:36 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
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by slyfox):

 * cc: slyfox (added)


Comment:

 I've found a few issues:
 - the implementations are slightly nonsymmetric (floatToWord# lacked F_
 cast)
 - i suspect cmm won't allow you to have non-Word sized integrals (the
 first error you get)
 - integral return type should also be Word-sized

 That compiles for me on both 32/64 targets:
 {{{
 #include "Cmm.h"

 stg_word32ToFloatzh(W_ w)
 {
     F_ f;
     P_ ptr;

     STK_CHK_GEN_N (1);

     reserve 1 = ptr {
         I32[ptr] = W_TO_INT(w);
         f = F_[ptr];
     }

     return (f);
 }

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

     STK_CHK_GEN_N (1);

     reserve 1 = ptr {
         F_[ptr] = f;
         w = TO_W_(I32[ptr]);
     }

     return (w);
 }
 }}}

 {{{
 $ m68k-unknown-linux-gnu-ghc -c a.cmm -dcmm-lint -O2
 $ powerpc64le-unknown-linux-gnu-ghc -c a.cmm -dcmm-lint -O2
 }}}

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


More information about the ghc-tickets mailing list