summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);