Bad code for Double literals
Caught by the vector benchmark suite. Small program:
foo :: [Double] -> [Double]
foo = map f
where
f x = 1 / x
The current head generates this rather terrible code (with -O2):
foo3 :: GHC.Integer.Type.Integer
foo3 = __integer 1
foo2 :: GHC.Types.Double
foo2 =
case GHC.Integer.Type.doubleFromInteger foo3
of wild_afu { __DEFAULT ->
GHC.Types.D# wild_afu
}
foo1 :: GHC.Types.Double -> GHC.Types.Double
foo1 =
\ (eta_B1 :: GHC.Types.Double) ->
GHC.Float.divideDouble foo2 eta_B1
foo :: [GHC.Types.Double] -> [GHC.Types.Double]
foo = GHC.Base.map @ GHC.Types.Double @ GHC.Types.Double foo1
It does generate perfectly fine code for this, though:
bar :: [Double] -> [Double]
bar = map (\x -> 1/x)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |