summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-04-04 21:46:55 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-04 21:47:00 -0400
commitaf941a96f62101a6539f3cc35d82df3fd964539c (patch)
tree003b7ee0cec3c889c6bf2988802e2596e86ca488
parent09d70107ac1634663ee09d6c0f98293dbb77db5f (diff)
downloadhaskell-af941a96f62101a6539f3cc35d82df3fd964539c.tar.gz
Add regression test for #7944
Commit b8b3e30a6eedf9f213b8a718573c4827cfa230ba happened to fix the bug reported in #7944. Let's add a regression test so that it stays that way. Fixes #7944. Test Plan: make test TEST=T7944 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3404
-rw-r--r--testsuite/tests/simplCore/should_compile/T7944.hs19
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T17
2 files changed, 28 insertions, 8 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T7944.hs b/testsuite/tests/simplCore/should_compile/T7944.hs
new file mode 100644
index 0000000000..bb62427e0a
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T7944.hs
@@ -0,0 +1,19 @@
+module T7944 where
+
+import GHC.Exts
+
+-- Force specialisation of "go"
+data SPEC = SPEC | SPEC2
+{-# ANN type SPEC ForceSpecConstr #-}
+
+-- This is more or less just an ordinary fold
+go :: SPEC -> [a] -> IntMap a -> IntMap a
+go SPEC [] m = m
+go SPEC (_:xs) m
+ = go SPEC xs
+ -- This would be the "worker function" of the fold
+ $ Unary m
+
+
+-- Both constructors are necessary, despite only one being used
+data IntMap a = Nil | Unary (IntMap a)
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 2d87e24a1b..1bf1f36d14 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -145,19 +145,20 @@ test('T7796', [], run_command, ['$MAKE -s --no-print-directory T7796'])
test('T5550', omit_ways(prof_ways), compile, [''])
test('T7865', normal, run_command, ['$MAKE -s --no-print-directory T7865'])
test('T7785', only_ways(['optasm']), compile, ['-ddump-rules'])
-test('T7702',
+test('T7702',
[extra_files(['T7702plugin']),
pre_cmd('$MAKE -s --no-print-directory -C T7702plugin package.T7702 TOP={top}'),
- clean_cmd('$MAKE -s --no-print-directory -C T7702plugin clean.T7702'),
- # we say 18mb peak allocated +/- 70% because other compiler flags have
- # a large effect on allocation which is hard to separate from the
- # allocation done by the plugin... but a regression allocates > 90mb
+ clean_cmd('$MAKE -s --no-print-directory -C T7702plugin clean.T7702'),
+ # we say 18mb peak allocated +/- 70% because other compiler flags have
+ # a large effect on allocation which is hard to separate from the
+ # allocation done by the plugin... but a regression allocates > 90mb
compiler_stats_num_field('peak_megabytes_allocated',
- [(wordsize(32), 18, 70), (wordsize(64), 18, 70)])
- ],
- compile,
+ [(wordsize(32), 18, 70), (wordsize(64), 18, 70)])
+ ],
+ compile,
['-v0 -package-db T7702plugin/pkg.T7702/local.package.conf -fplugin T7702Plugin -package T7702plugin ' + config.plugin_way_flags])
+test('T7944', normal, compile, ['-O2'])
test('T7995',
# RULE doesn't seem to fire unless optimizations are turned on.
# This seems reasonable, so I've required it for the test. -- EZY 20130720