diff options
Diffstat (limited to 'testsuite/tests/simplCore/should_run/T3437.hs')
-rw-r--r-- | testsuite/tests/simplCore/should_run/T3437.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_run/T3437.hs b/testsuite/tests/simplCore/should_run/T3437.hs new file mode 100644 index 0000000000..9ef6ee8b82 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T3437.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE BangPatterns #-} +{-# OPTIONS_GHC -O2 #-} + +-- Trac #3437 +-- When we do SpecConstr on 'go', we want the specialised +-- function to *still* be strict in k. Otherwise we get +-- a bad space leak! + +-- The test is run with +RTS -M10m to limit the amount of heap +-- It should run in constant space, but if the function isn't +-- strict enough it'll run out of heap + +module Main where + +go :: [Int] -> [Int] -> [Int] +go (0:xs) !k = k +go (n:xs) !k = go (n-1 : xs) (k ++ k) + +main = print (go [100000000] []) |