[commit: ghc] wip/12368: DmdAnal: Testcase about splitFVs and dmdFix abortion (6d98600)

git at git.haskell.org git at git.haskell.org
Thu Jul 21 15:45:32 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/12368
Link       : http://ghc.haskell.org/trac/ghc/changeset/6d98600446d0a2e391ef93510df49fbba8cea84b/ghc

>---------------------------------------------------------------

commit 6d98600446d0a2e391ef93510df49fbba8cea84b
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Jul 21 17:44:25 2016 +0200

    DmdAnal: Testcase about splitFVs and dmdFix abortion
    
    Any variable with useful information (strict or used-once) will not be
    included in lazy_fv (according to splitFVs). If we now also remove them
    from the strictness signatures, their uses are not recorded anywhere –
    and then probably considered absent.


>---------------------------------------------------------------

6d98600446d0a2e391ef93510df49fbba8cea84b
 testsuite/tests/stranal/should_run/T12368a.hs     | 27 +++++++++++++++++++++++
 testsuite/tests/stranal/should_run/T12368a.stderr |  3 +++
 testsuite/tests/stranal/should_run/all.T          |  1 +
 3 files changed, 31 insertions(+)

diff --git a/testsuite/tests/stranal/should_run/T12368a.hs b/testsuite/tests/stranal/should_run/T12368a.hs
new file mode 100644
index 0000000..738e8ef
--- /dev/null
+++ b/testsuite/tests/stranal/should_run/T12368a.hs
@@ -0,0 +1,27 @@
+-- Needs to be a product type
+data Stream = S Int Stream
+
+-- a is wrongly recorded abstent if the non-lazy-fv from foo are thrown away. 
+bar :: Int -> Int -> Stream -> Int
+bar a n s = foo n s
+  where
+    -- Non terminating local rec, strict in a
+    foo :: Int -> Stream -> Int
+    foo 0 (S n s) = a
+    foo i (S n s) = a `seq` n + foo (i-1) s
+{-# NOINLINE bar #-}
+
+
+baz :: Int -> Int -> Int
+baz 0 not_absent = 0
+baz 1 not_absent = baz 2 not_absent
+baz x not_absent = bar not_absent 1000 arg
+  where
+    arg = S 1 arg
+
+bamf x = baz x (error "This is good!")
+{-# NOINLINE bamf #-}
+
+
+main :: IO ()
+main = bamf 10 `seq` return ()
diff --git a/testsuite/tests/stranal/should_run/T12368a.stderr b/testsuite/tests/stranal/should_run/T12368a.stderr
new file mode 100644
index 0000000..98246d3
--- /dev/null
+++ b/testsuite/tests/stranal/should_run/T12368a.stderr
@@ -0,0 +1,3 @@
+T12368a: This is good!
+CallStack (from HasCallStack):
+  error, called at T12368a.hs:22:17 in main:Main
diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T
index 5b976f1..fb678b4 100644
--- a/testsuite/tests/stranal/should_run/all.T
+++ b/testsuite/tests/stranal/should_run/all.T
@@ -13,3 +13,4 @@ test('T10218', normal, compile_and_run, [''])
 test('T11076', normal, multimod_compile_and_run, ['T11076.hs', 'T11076_prim.cmm'])
 test('T11555a', normal, compile_and_run, [''])
 test('T12368', exit_code(1), compile_and_run, [''])
+test('T12368a', [expect_broken(12368), exit_code(1)], compile_and_run, [''])



More information about the ghc-commits mailing list