Commit d3bfd676 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Fix simplrun010 test

Compiler now (correctly) does not eta reduce an infinite loop,
so I had to adjust the test a bit.
parent 94a1cf19
......@@ -18,8 +18,8 @@ test('simplrun005', normal, compile_and_run, [''])
test('simplrun007', normal, compile_and_run, [''])
test('simplrun008', normal, compile_and_run, [''])
test('simplrun009', normal, compile_and_run, [''])
test('simplrun010', composes([extra_run_opts('24 16 8'),
exit_code(1)])
test('simplrun010', composes([extra_run_opts('24 16 8 +RTS -M10m -RTS'),
exit_code(251)])
, compile_and_run, [''])
# Really we'd like to run T2486 too, to check that its
......
{-# LANGUAGE ForeignFunctionInterface, MagicHash, UnboxedTuples #-}
-- From trac #1947
-- Should fail with heap exhaustion
-- See notes below with "Infinite loop here".
module Main(main) where
......@@ -244,9 +246,20 @@ f20 v1 v2 =
prelude_error
(skipCAF realWorld# (str_ "Prelude.read: ambiguous parse"))
-- Infinite loop here. It was originally:
-- f34 v1 v2 v3 =
-- let v336 = f34 v1 v2 v3
-- in v336
--
-- But that now (correctly) just makes a non-allocating infinite loop
-- instead of (incorrectly) eta-reducing to f34 = f34.
-- So I've changed to an infinite, allocating loop, which makes
-- the heap get exhausted.
f34 v1 v2 v3 =
let v336 = f34 v1 v2 v3
if abs v2 < 1000 then
let v336 = f34 (v1+1) (-v2) v3
in v336
else if v2 == 2000 then 0 else v1
f38 v1 v2 =
case v1 of
......
simplrun010: <<loop>>
simplrun010: Heap exhausted;
Current maximum heap size is 10485760 bytes (10 MB);
use `+RTS -M<size>' to increase it.
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