[GHC] #16372: GHC can't constant fold even basic power (^) applications for Int (and others?)

GHC ghc-devs at haskell.org
Thu Feb 28 09:28:11 UTC 2019


#16372: GHC can't constant fold even basic power (^) applications for Int (and
others?)
-------------------------------------+-------------------------------------
           Reporter:  Fuuzetsu       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           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:
-------------------------------------+-------------------------------------
 {{{#!hs
 [nix-shell:/tmp]$ ghc -O2 -fforce-recomp -ddump-simpl S.hs 2>&1 | tail
 [GblId,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 50 20}]
 foo
   = case GHC.Real.$wf1 2# 1# of ww2_a2zt { __DEFAULT ->
     GHC.Types.I# ww2_a2zt
     }

 [nix-shell:/tmp]$ cat S.hs
 module S (fuck) where
 foo :: Int
 foo = (2 :: Int) ^ (1 :: Int)
 }}}

 This seems like a fairly strange thing to not optimise when constants are
 known on both sides. I'm complaining about Int for this particular ticket.

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


More information about the ghc-tickets mailing list