add test from #5363
authorSimon Marlow <marlowsd@gmail.com>
Wed, 7 Dec 2011 15:53:43 +0000 (15:53 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 7 Dec 2011 16:27:40 +0000 (16:27 +0000)
testsuite/tests/profiling/should_run/T5363.hs [new file with mode: 0644]
testsuite/tests/profiling/should_run/T5363.stdout [new file with mode: 0644]
testsuite/tests/profiling/should_run/all.T

diff --git a/testsuite/tests/profiling/should_run/T5363.hs b/testsuite/tests/profiling/should_run/T5363.hs
new file mode 100644 (file)
index 0000000..5167bbe
--- /dev/null
@@ -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 (file)
index 0000000..a10b915
--- /dev/null
@@ -0,0 +1 @@
+1250030000000
index 154d382..0298c42 100644 (file)
@@ -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, [''])
+