[GHC] #10555: RULE left-hand side too complicated to desugar

GHC ghc-devs at haskell.org
Thu Sep 24 13:18:31 UTC 2015


#10555: RULE left-hand side too complicated to desugar
-------------------------------------+-------------------------------------
        Reporter:  yongqli           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  low               |               Milestone:
       Component:  Compiler          |                 Version:  7.0.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:  yes
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by thomie):

 * related:  #10699 =>


Old description:

> GHC reports the following warnings for the `fast-math` package. To
> reproduce, run `cabal install fast-math==1.0 --with-ghc=ghc-7.10.1`
> (ghc-7.10.2 panics on this package, see #10699).
>
> {{{
>
> Numeric/FastMath/Approximation.hs:60:1: Warning:
>     RULE left-hand side too complicated to desugar
>       Optimised lhs: case /## y2 x of wild_00 { __DEFAULT ->
>                      (case /## y1 x of wild_X2 { __DEFAULT -> +## wild_X2
> }) wild_00
>                      }
>       Orig lhs: case /## y2 x of wild_00 { __DEFAULT ->
>                 (case /## y1 x of wild_00 { __DEFAULT -> +## wild_00 })
> wild_00
>                 }
>
> Numeric/FastMath/Approximation.hs:63:1: Warning:
>     RULE left-hand side too complicated to desugar
>       Optimised lhs: case /## y2 x of wild_00 { __DEFAULT ->
>                      (case /## y1 x of wild_X2 { __DEFAULT -> -## wild_X2
> }) wild_00
>                      }
>       Orig lhs: case /## y2 x of wild_00 { __DEFAULT ->
>                 (case /## y1 x of wild_00 { __DEFAULT -> -## wild_00 })
> wild_00
>                 }
>
> Numeric/FastMath/Approximation.hs:103:1: Warning:
>     RULE left-hand side too complicated to desugar
>       Optimised lhs: case divideFloat# y2 x of wild_00 { __DEFAULT ->
>                      (case divideFloat# y1 x of wild_X2 { __DEFAULT ->
>                       minusFloat# wild_X2
>                       })
>                        wild_00
>                      }
>       Orig lhs: case divideFloat# y2 x of wild_00 { __DEFAULT ->
>                 (case divideFloat# y1 x of wild_00 { __DEFAULT ->
>                  minusFloat# wild_00
>                  })
>                   wild_00
>                 }
> }}}

New description:

 GHC reports multiple "RULE left-hand side too complicated to desugar"
 warnings for the `fast-math` package.

 Here is an testcase, extracted from `fast-
 math/Numeric/FastMath/Approximation.hs`:

 {{{
 {-# LANGUAGE MagicHash #-}
 module T10555 where

 import GHC.Exts

 {-# RULES

 "double /,+ distribute" forall x y1 y2. (y1 /## x) +## (y2 /## x)
     = (y1 +## y2) /## x

 "double /,- distribute" forall x y1 y2. (y1 /## x) -## (y2 /## x)
     = (y1 -## y2) /## x

 "float /,- distribute" forall x y1 y2. (y1 `divideFloat#` x) `minusFloat#`
 (y2 `divideFloat#` x)
     = (y1 `minusFloat#` y2) `divideFloat#` x

   #-}
 }}}

 {{{
 2$ ghc-7.10.2 T10555.hs  -fforce-recomp
 [1 of 1] Compiling T10555           ( T10555.hs, T10555.o )

 T10555.hs:8:1: Warning:
     RULE left-hand side too complicated to desugar
       Optimised lhs: case /## y2 x of wild_00 { __DEFAULT ->
                      (case /## y1 x of wild_X2 { __DEFAULT -> +## wild_X2
 }) wild_00
                      }
       Orig lhs: case /## y2 x of wild_00 { __DEFAULT ->
                 (case /## y1 x of wild_00 { __DEFAULT -> +## wild_00 })
 wild_00
                 }

 T10555.hs:11:1: Warning:
     RULE left-hand side too complicated to desugar
       Optimised lhs: case /## y2 x of wild_00 { __DEFAULT ->
                      (case /## y1 x of wild_X2 { __DEFAULT -> -## wild_X2
 }) wild_00
                      }
       Orig lhs: case /## y2 x of wild_00 { __DEFAULT ->
                 (case /## y1 x of wild_00 { __DEFAULT -> -## wild_00 })
 wild_00
                 }

 T10555.hs:14:1: Warning:
     RULE left-hand side too complicated to desugar
       Optimised lhs: case divideFloat# y2 x of wild_00 { __DEFAULT ->
                      (case divideFloat# y1 x of wild_X2 { __DEFAULT ->
                       minusFloat# wild_X2
                       })
                        wild_00
                      }
       Orig lhs: case divideFloat# y2 x of wild_00 { __DEFAULT ->
                 (case divideFloat# y1 x of wild_00 { __DEFAULT ->
                  minusFloat# wild_00
                  })
                   wild_00
                 }
 }}}

--

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


More information about the ghc-tickets mailing list