Commit bb2a08e1 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

testsuite: Add test for #14257

Subscribers: rwbarton, thomie, duog

GHC Trac Issues: #14257

Differential Revision: https://phabricator.haskell.org/D4201
parent 0db4627b
......@@ -33,3 +33,11 @@ T11489:
# then continue to run and exit normally.
# Caused a segmentation fault in GHC <= 7.10.3
./T11489 +RTS -hr{} -hc
.PHONY: T14257
T14257:
$(RM) T14257
"$(TEST_HC)" -O2 --make -prof -v0 -fprof-auto T14257.hs
./T14257 +RTS -hc
# Make sure that samples are monotonically increasing
awk 'BEGIN{t=0} /BEGIN_SAMPLE/{if ($$2 < t) print "uh oh", $$t, $$0; t=$$2;}' T14257.hp
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
eval :: forall a b. (a -> b -> b) -> b -> [a] -> b
eval f b xs = load xs []
where
load :: [a] -> [a] -> b
load [] stk = unload b stk
load (x:xs) stk = load xs (x : stk)
unload :: b -> [a] -> b
unload v [] = v
unload v (x : stk) = unload ((f $! x) $! v) stk
main :: IO ()
main = print (eval (||) False (True : replicate 10000000 False))
......@@ -132,3 +132,5 @@ test('toplevel_scc_1',
[''])
test('T12962', [], compile_and_run, [''])
test('T14257', [], run_command, ['$MAKE -s --no-print-directory T14257'])
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