summaryrefslogtreecommitdiff
path: root/testsuite/tests/profiling
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-02-23 09:05:37 +0000
committerSimon Marlow <marlowsd@gmail.com>2016-02-23 09:05:37 +0000
commitd3cf2a9bf8c3780a681273ae46aea0fc8f40374e (patch)
tree51681b07db67b4f5f1bc9f3060861abfd0d7e439 /testsuite/tests/profiling
parented119096be6739b67d99acfa4c2d43627960f0e3 (diff)
downloadhaskell-d3cf2a9bf8c3780a681273ae46aea0fc8f40374e.tar.gz
Add missing files
Diffstat (limited to 'testsuite/tests/profiling')
-rw-r--r--testsuite/tests/profiling/should_run/T5654b-O0.hs22
-rw-r--r--testsuite/tests/profiling/should_run/T5654b-O1.hs22
2 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/tests/profiling/should_run/T5654b-O0.hs b/testsuite/tests/profiling/should_run/T5654b-O0.hs
new file mode 100644
index 0000000000..2a00abf912
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/T5654b-O0.hs
@@ -0,0 +1,22 @@
+-- A variant of T5654 where instead of evaluating directly to a
+-- funciton, f evaluates to a new PAP. This exposes a slightly
+-- different but related bug, where when we create a new PAP by
+-- applying arguments to an existing PAP, we should take into account
+-- the stack on the original PAP.
+
+-- The stack we should see is main->f->g->h, but if we get this wrong
+-- (GHC 7.10) then the stack is main->f->h.
+
+{-# NOINLINE f #-}
+f :: Int -> Int
+f = g 3
+
+{-# NOINLINE g #-}
+g :: Int -> Int -> Int
+g = h 4
+
+{-# NOINLINE h #-}
+h :: Int -> Int -> Int -> Int
+h x y z = x + y + z
+
+main = return $! f 5
diff --git a/testsuite/tests/profiling/should_run/T5654b-O1.hs b/testsuite/tests/profiling/should_run/T5654b-O1.hs
new file mode 100644
index 0000000000..2a00abf912
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/T5654b-O1.hs
@@ -0,0 +1,22 @@
+-- A variant of T5654 where instead of evaluating directly to a
+-- funciton, f evaluates to a new PAP. This exposes a slightly
+-- different but related bug, where when we create a new PAP by
+-- applying arguments to an existing PAP, we should take into account
+-- the stack on the original PAP.
+
+-- The stack we should see is main->f->g->h, but if we get this wrong
+-- (GHC 7.10) then the stack is main->f->h.
+
+{-# NOINLINE f #-}
+f :: Int -> Int
+f = g 3
+
+{-# NOINLINE g #-}
+g :: Int -> Int -> Int
+g = h 4
+
+{-# NOINLINE h #-}
+h :: Int -> Int -> Int -> Int
+h x y z = x + y + z
+
+main = return $! f 5