Another case of SpecConstr not specialising
Compile with -O2 -fno-spec-constr-count -fno-spec-constr-threshold:
foo :: Int -> Int -> Int -> (Int,Int)
foo !a !b !c = loop (Left (a,b))
where
loop :: Either (Int,Int) (Int, (Int,Int)) -> (Int,Int)
loop (Left (!x,!n))
| n > 0 = loop (Right (x,(x+c,n-1)))
| otherwise = (x,n)
loop (Right (i,t))
| i < c = loop (Right (i+1,t))
| otherwise = loop (Left t)
!SpecConstr doesn't specialise for the (Int,Int) pair. Unless I'm mistaken, the !SpecConstr loop should get this since the call in foo has the form Left (I# x, I# y) and the pair then gets threaded through the loop.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |