summaryrefslogtreecommitdiff
path: root/testsuite/tests/th
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-11-17 09:50:18 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-01 03:09:58 -0500
commit0833ad5516738ebd65907cad17a383da9e3bded9 (patch)
treefb929c1fc62f0574ed47aa57df89306a596848ae /testsuite/tests/th
parent4c434c9e3bf3c906285d168bfd98e1b276808f47 (diff)
downloadhaskell-0833ad5516738ebd65907cad17a383da9e3bded9.tar.gz
Add failing test for #20674
Diffstat (limited to 'testsuite/tests/th')
-rw-r--r--testsuite/tests/th/T20674/Main.hs6
-rw-r--r--testsuite/tests/th/T20674/P.hs11
-rw-r--r--testsuite/tests/th/T20674/all.T10
-rw-r--r--testsuite/tests/th/T20674/foo.c6
-rw-r--r--testsuite/tests/th/T20674/header.h3
5 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/th/T20674/Main.hs b/testsuite/tests/th/T20674/Main.hs
new file mode 100644
index 0000000000..17d9a53b9a
--- /dev/null
+++ b/testsuite/tests/th/T20674/Main.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Main where
+
+import P
+
+main = $([| return () |])
diff --git a/testsuite/tests/th/T20674/P.hs b/testsuite/tests/th/T20674/P.hs
new file mode 100644
index 0000000000..031b3fd032
--- /dev/null
+++ b/testsuite/tests/th/T20674/P.hs
@@ -0,0 +1,11 @@
+module P where
+
+foreign export ccall foo :: Int -> IO Int
+
+foo :: Int -> IO Int
+foo n = return (length (f n))
+
+f :: Int -> [Int]
+f 0 = []
+f n = n:(f (n-1))
+
diff --git a/testsuite/tests/th/T20674/all.T b/testsuite/tests/th/T20674/all.T
new file mode 100644
index 0000000000..d85d0678b2
--- /dev/null
+++ b/testsuite/tests/th/T20674/all.T
@@ -0,0 +1,10 @@
+setTestOpts(req_interp)
+# TH should work with -fexternal-interpreter too
+if config.have_ext_interp :
+ setTestOpts(extra_ways(['ext-interp']))
+ setTestOpts(only_ways(['normal','ghci','ext-interp']))
+
+ if llvm_build():
+ setTestOpts(fragile_for(16087, ['ext-interp']))
+
+test('T20674', [expect_broken(20674), extra_files(['Main.hs', 'P.hs', 'foo.c', 'header.h'])], multimod_compile, ['Main', 'P foo.c'])
diff --git a/testsuite/tests/th/T20674/foo.c b/testsuite/tests/th/T20674/foo.c
new file mode 100644
index 0000000000..8c244a5957
--- /dev/null
+++ b/testsuite/tests/th/T20674/foo.c
@@ -0,0 +1,6 @@
+#include "header.h"
+
+int q() {
+ int e = foo(0);
+ return(0);
+}
diff --git a/testsuite/tests/th/T20674/header.h b/testsuite/tests/th/T20674/header.h
new file mode 100644
index 0000000000..56d43139cc
--- /dev/null
+++ b/testsuite/tests/th/T20674/header.h
@@ -0,0 +1,3 @@
+#include <HsFFI.h>
+
+int foo(int);