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

"GHC" <[email protected]>
Newsgroups gmane.comp.lang.haskell.glasgow.bugs
Message-ID <[email protected]>
#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>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.