[GHC] #11131: Eta reduction/expansion loop

GHC ghc-devs at haskell.org
Wed Nov 25 12:46:10 UTC 2015


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

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


More information about the ghc-tickets mailing list