From 03ee7cd12f97a24907d1d3f8361c4c57b22a7e72 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Wed, 7 Dec 2011 15:53:43 +0000 Subject: add test from #5363 --- testsuite/tests/profiling/should_run/T5363.hs | 12 ++++++++++++ testsuite/tests/profiling/should_run/T5363.stdout | 1 + testsuite/tests/profiling/should_run/all.T | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 testsuite/tests/profiling/should_run/T5363.hs create mode 100644 testsuite/tests/profiling/should_run/T5363.stdout (limited to 'testsuite/tests/profiling') diff --git a/testsuite/tests/profiling/should_run/T5363.hs b/testsuite/tests/profiling/should_run/T5363.hs new file mode 100644 index 0000000000..5167bbe6e0 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T5363.hs @@ -0,0 +1,12 @@ +import Data.Array.Unboxed + +main = do + let l1 = [1..10] :: [Int] + let l2 = [ map (i+) l1 | i <- [1..500000] ] + let l3 = map (\l -> listArray (1,length l) l) l2 :: [UArray Int Int] + print $ accumulate l3 0 + +accumulate [] rv = rv +accumulate (h:t) rv = + let nextRv = (rv + sum (elems h)) in + accumulate t $! nextRv diff --git a/testsuite/tests/profiling/should_run/T5363.stdout b/testsuite/tests/profiling/should_run/T5363.stdout new file mode 100644 index 0000000000..a10b91560b --- /dev/null +++ b/testsuite/tests/profiling/should_run/T5363.stdout @@ -0,0 +1 @@ +1250030000000 diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 154d3829b8..0298c42141 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -107,3 +107,9 @@ test('callstack001', test('callstack002', [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ], compile_and_run, ['-fprof-auto-calls -fno-full-laziness -fno-state-hack']) + +# Should not stack overflow with -prof -auto-all +test('T5363', + [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ], + compile_and_run, ['']) + -- cgit v1.2.1