summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-03-14 13:52:48 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-03-14 13:55:30 +0000
commit82b40598ea7a9c00abdeae37bc47896f880fbbdc (patch)
treea70448d6ed7efb5c4b57a65d4d07bb012ea08c0d /testsuite
parent50512c6b2bd878f0be5e1c7b85cadf22094aaa5a (diff)
downloadhaskell-82b40598ea7a9c00abdeae37bc47896f880fbbdc.tar.gz
Fix CaseIdentity optimisation AGAIN
In this commit commit 02ac2974ce8e537372bff8d9e0a6efb461ed2c59 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Wed Nov 16 10:37:47 2011 +0000 Fix CaseIdentity optimisaion In fixing one bug I'd introduced another; case x of { T -> T; F -> F } wasn't getting optmised! Trivial to fix. I introduced yet another! This line of code in SimplUtils.mkCase1 check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con -- Optimisation only is patently false when arg_tys is non-empty. Astonishing that it has not shown up before now. Easily fixed though. This was all shown up by Trac #13417, which is now fixed. Merge to 8.0, 8.2.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/T13417.hs8
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
2 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T13417.hs b/testsuite/tests/simplCore/should_compile/T13417.hs
new file mode 100644
index 0000000000..a919291bb7
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T13417.hs
@@ -0,0 +1,8 @@
+module T13417 where
+
+-- Amazingly this crashed GHC 8.0.2
+
+data T a = E7
+
+cons7 :: T a -> T b
+cons7 E7 = E7
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 7bad786b93..5265569503 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -250,3 +250,4 @@ test('T13317',
test('T13340', normal, run_command, ['$MAKE -s --no-print-directory T13340'])
test('T13338', only_ways(['optasm']), compile, ['-dcore-lint'])
test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367'])
+test('T13417', normal, compile, ['-O'])