Commit 2623cbad authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add Test for Trac #4830

parent f592af1d
-- Compile with O2; SpecConstr should fire nicely
-- and eliminate all allocation in inner loop
module Main where
foo :: Int -> Maybe (Double,Double) -> Double
foo _ Nothing = 0
foo 0 (Just (x,y)) = x+y
foo n (Just (x,y)) = let r = f x y in r `seq` foo (n-1) (Just r)
where
f x y | x <= y = (x,y)
| otherwise = (y,x)
main = print (foo 1000000 (Just (1,2)))
......@@ -15,6 +15,15 @@ test('3586',
compile_and_run,
['-O'])
test('T4830',
[stats_num_field('bytes allocated', 60000,
200000),
# expected value: 127,000 (amd64/Linux)
only_ways(['normal'])
],
compile_and_run,
['-O2'])
test('T3245', normal, compile_and_run, ['-O'])
# Test that bytestring reading/writing isn't over-allocating. We had
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment