[GHC] #11131: Eta reduction/expansion loop

GHC ghc-devs at haskell.org
Wed Nov 25 23:07:22 UTC 2015


#11131: Eta reduction/expansion loop
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by simonpj:

Old description:

> In the build log for HEAD today you'll see:
> {{{
> WARNING: file compiler\simplCore\SimplCore.hs, line 604
>   Simplifier bailing out after 10 iterations [148, 4, 4, 4, 4, 4, 4, 4,
> 4, 4]
>     Size = {terms: 290, types: 237, coercions: 56}
> }}}
> when compiling`Data/ByteString/Builder/Prim/Internal/Floating.hs`.
>
> There is a loop here: in each simplifier pass we get an eta-expansion and
> an eta reduction, which cancel each other out.  This is bad.
>
> Here is the offending snippet of code
> {{{
> ((bindIO @ () @ ()
>     ($fStorableDouble_$cpoke
>        (castPtr @ Word8 @ Double op)
>        x)
>     ((\ (ds :: ()) ->
>         (\ (eta_B1 :: State# RealWorld) ->
>            (k `cast` (NTCo:IO[0] <()>_R
>                      :: IO ()
>                         ~R# (State# RealWorld -> (# State# RealWorld, ()
> #))))
>             eta_B1)
>         `cast` (Sym (NTCo:IO[0] <()>_R)
>                 :: (State# RealWorld -> (# State# RealWorld, () #))
>                    ~R# IO ()))
>      `cast` (<()>_R
>              -> NTCo:IO[0] <()>_R ; Sym (NTCo:IO[0] <()>_R)
>              :: (() -> IO ()) ~R# (() -> IO ()))))
>  `cast` (NTCo:IO[0] <()>_R
>          :: IO () ~R# (State# RealWorld -> (# State# RealWorld, () #))))
> }}}
> At this point `k` is in scope with arity 2.  Actually its binding is
> {{{
> k :: IO ()
> k = bindIO @ Word64 @ () a_s2As a_s2Au
> }}}
> I'm not precisely sure why this goes wrong, but it's very clearly bogus,
> so I'm opening a ticket to keep track.

New description:

 In the build log for HEAD today you'll see:
 {{{
 WARNING: file compiler\simplCore\SimplCore.hs, line 604
   Simplifier bailing out after 10 iterations [148, 4, 4, 4, 4, 4, 4, 4, 4,
 4]
     Size = {terms: 290, types: 237, coercions: 56}
 }}}
 when compiling`Data/ByteString/Builder/Prim/Internal/Floating.hs`.

 There is a loop here: in each simplifier pass we get an eta-expansion and
 an eta reduction, which cancel each other out.  This is bad.

 Here is the offending snippet of code
 {{{
 ((bindIO @ () @ ()
     ($fStorableDouble_$cpoke
        (castPtr @ Word8 @ Double op)
        x)
     ((\ (ds :: ()) ->
         (\ (eta_B1 :: State# RealWorld) ->
            (k `cast` (NTCo:IO[0] <()>_R
                      :: IO ()
                         ~R# (State# RealWorld -> (# State# RealWorld, ()
 #))))
             eta_B1)
         `cast` (Sym (NTCo:IO[0] <()>_R)
                 :: (State# RealWorld -> (# State# RealWorld, () #))
                    ~R# IO ()))
      `cast` (<()>_R
              -> NTCo:IO[0] <()>_R ; Sym (NTCo:IO[0] <()>_R)
              :: (() -> IO ()) ~R# (() -> IO ()))))
  `cast` (NTCo:IO[0] <()>_R
          :: IO () ~R# (State# RealWorld -> (# State# RealWorld, () #))))
 }}}
 At this point `k` is in scope with arity 1.  Actually its binding is
 {{{
 k :: IO ()
 k = bindIO @ Word64 @ () a_s2As a_s2Au
 }}}
 I'm not precisely sure why this goes wrong, but it's very clearly bogus,
 so I'm opening a ticket to keep track.

--

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


More information about the ghc-tickets mailing list