summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2020-02-04 09:37:19 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-14 05:29:56 -0500
commitcd6e786a28cc6688b45c8868a3e8a338b081ba01 (patch)
treebfdbad8e04ed5cd0c84cd4aa340b6bfe9fc7053a /testsuite/tests/codeGen
parent1bfd825943f6077836361ddc788fb40f2421e283 (diff)
downloadhaskell-cd6e786a28cc6688b45c8868a3e8a338b081ba01.tar.gz
Add test for #17648
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_compile/Makefile17
-rw-r--r--testsuite/tests/codeGen/should_compile/T17648.hs10
-rw-r--r--testsuite/tests/codeGen/should_compile/all.T2
3 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile
index 58e0e5642c..3c4339bd8c 100644
--- a/testsuite/tests/codeGen/should_compile/Makefile
+++ b/testsuite/tests/codeGen/should_compile/Makefile
@@ -58,3 +58,20 @@ T15155l:
'$(TEST_HC)' $(TEST_HC_OPTS) -c -O0 -ddump-llvm T15155l.hs 2>/dev/null \
| grep -F "= alias %T15155_" | grep -E "@T15155_[ab]_closure.def = " | grep -F "%T15155_a_closure_struct*" \
| wc -l | sed -e 's/ *//g' | grep "2"; echo $$?
+
+# Without -fcatch-bottoms `f` is non-CAFFY. With -fcatch-bottoms it becomes
+# CAFFY. Before CafInfo rework (c846618a) this used to cause incorrect CafInfo
+# attached to `f` in the interface file.
+T17648:
+ # -dno-typeable-binds is to make the iface simpler
+ # -O is necessary as otherwise we don't write interface pragmas (e.g.
+ # NoCafRefs) to the interface files.
+ '$(TEST_HC)' $(TEST_HC_OPTS) -dno-typeable-binds -O T17648.hs -v0
+ '$(TEST_HC)' --show-iface T17648.hi | tr -d '\n' | \
+ grep -F 'f :: T GHC.Types.Int -> () {- HasNoCafRefs, Arity' >/dev/null
+
+ # Second compilation with -fcatch-bottoms, f should be CAFFY
+ '$(TEST_HC)' $(TEST_HC_OPTS) -dno-typeable-binds -O \
+ -fcatch-bottoms T17648.hs -v0 -fforce-recomp
+ '$(TEST_HC)' --show-iface T17648.hi | tr -d '\n' | \
+ grep -F 'f :: T GHC.Types.Int -> () {- Arity: 1, Strictness' >/dev/null
diff --git a/testsuite/tests/codeGen/should_compile/T17648.hs b/testsuite/tests/codeGen/should_compile/T17648.hs
new file mode 100644
index 0000000000..6d050c1257
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T17648.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE GADTs #-}
+
+module T17648 where
+
+data T a where
+ A :: T Int
+ B :: T Bool
+
+f :: T Int -> ()
+f A = ()
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index f69986e9b8..83cedc8015 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -89,3 +89,5 @@ switch_skeleton_and_entries_only = ('grep -e "switch \[" -e "case " -e "default:
test('T14373d', [],
multimod_compile_filter, ['T14373d', '-fasm -O2 -c -ddump-cmm-from-stg',
switch_skeleton_and_entries_only])
+
+test('T17648', normal, makefile_test, [])