diff --git a/ghc/tests/typecheck/should_run/tcrun002.hs b/ghc/tests/typecheck/should_run/tcrun002.hs new file mode 100644 index 0000000000000000000000000000000000000000..79174022124d1cfe0eb70e86ccc44abe0f6ca474 --- /dev/null +++ b/ghc/tests/typecheck/should_run/tcrun002.hs @@ -0,0 +1,18 @@ +module Main where + +--!!! space leak from overloading !!! + +-- This program develops a space leak if sfoldl isn't compiled with some +-- care. See comment about polymorphic recursion in TcMonoBinds.lhs + +import System(getArgs) +import IOBase +import STBase + +sfoldl :: Eval a => (a -> Int -> a) -> a -> [Int] -> a +sfoldl f z [] = z +sfoldl f z (x:xs) = _scc_ "sfoldl1" (sfoldl f fzx (fzx `seq` xs)) + where fzx = _scc_ "fzx" (f z x) + + +main = IO (\s -> case print (sfoldl (+) (0::Int) [1..200000]) of { IO a -> a s }) diff --git a/ghc/tests/typecheck/should_run/tcrun002.stdout b/ghc/tests/typecheck/should_run/tcrun002.stdout new file mode 100644 index 0000000000000000000000000000000000000000..928909f8160cff93bffc279d8a541826c7908983 --- /dev/null +++ b/ghc/tests/typecheck/should_run/tcrun002.stdout @@ -0,0 +1 @@ +-1474736480