summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/1959
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/driver/1959')
-rw-r--r--testsuite/tests/driver/1959/1959.stdout2
-rw-r--r--testsuite/tests/driver/1959/B.hs6
-rw-r--r--testsuite/tests/driver/1959/C.hs5
-rw-r--r--testsuite/tests/driver/1959/D.hs7
-rw-r--r--testsuite/tests/driver/1959/E1.hs4
-rw-r--r--testsuite/tests/driver/1959/E2.hs4
-rw-r--r--testsuite/tests/driver/1959/Makefile25
-rw-r--r--testsuite/tests/driver/1959/test.T5
8 files changed, 58 insertions, 0 deletions
diff --git a/testsuite/tests/driver/1959/1959.stdout b/testsuite/tests/driver/1959/1959.stdout
new file mode 100644
index 0000000000..3db47397ee
--- /dev/null
+++ b/testsuite/tests/driver/1959/1959.stdout
@@ -0,0 +1,2 @@
+16
+14
diff --git a/testsuite/tests/driver/1959/B.hs b/testsuite/tests/driver/1959/B.hs
new file mode 100644
index 0000000000..8523c17bb4
--- /dev/null
+++ b/testsuite/tests/driver/1959/B.hs
@@ -0,0 +1,6 @@
+module Main where
+
+import C (x)
+import GHC.Exts (inline)
+
+main = print (inline x)
diff --git a/testsuite/tests/driver/1959/C.hs b/testsuite/tests/driver/1959/C.hs
new file mode 100644
index 0000000000..9106a32495
--- /dev/null
+++ b/testsuite/tests/driver/1959/C.hs
@@ -0,0 +1,5 @@
+module C (x) where
+
+import D
+
+x = f 2
diff --git a/testsuite/tests/driver/1959/D.hs b/testsuite/tests/driver/1959/D.hs
new file mode 100644
index 0000000000..8ff5b1397d
--- /dev/null
+++ b/testsuite/tests/driver/1959/D.hs
@@ -0,0 +1,7 @@
+module D (f) where
+
+import E
+
+{-# INLINE f #-}
+f :: Int -> Int
+f x = h x
diff --git a/testsuite/tests/driver/1959/E1.hs b/testsuite/tests/driver/1959/E1.hs
new file mode 100644
index 0000000000..1efb41b3e4
--- /dev/null
+++ b/testsuite/tests/driver/1959/E1.hs
@@ -0,0 +1,4 @@
+module E (h) where
+
+h :: Int -> Int
+h x = x + x + x + x + x + x + x + x
diff --git a/testsuite/tests/driver/1959/E2.hs b/testsuite/tests/driver/1959/E2.hs
new file mode 100644
index 0000000000..cb0ca32ad0
--- /dev/null
+++ b/testsuite/tests/driver/1959/E2.hs
@@ -0,0 +1,4 @@
+module E (h) where
+
+h :: Int -> Int
+h x = x + x + x + x + x + x + x
diff --git a/testsuite/tests/driver/1959/Makefile b/testsuite/tests/driver/1959/Makefile
new file mode 100644
index 0000000000..844a442afa
--- /dev/null
+++ b/testsuite/tests/driver/1959/Makefile
@@ -0,0 +1,25 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Test recompilation bug #1959, which failed in 6.8.1 (and earlier)
+
+compile ::
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O E.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O D.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -funfolding-use-threshold=0 C.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) E.o D.o C.o B.o -o prog
+
+clean ::
+ rm -f *.o *.hi E.hs
+
+dotest ::
+ $(MAKE) clean
+ cp E1.hs E.hs
+ $(MAKE) compile
+ ./prog
+ sleep 1
+ cp E2.hs E.hs
+ $(MAKE) compile
+ ./prog
diff --git a/testsuite/tests/driver/1959/test.T b/testsuite/tests/driver/1959/test.T
new file mode 100644
index 0000000000..ff9e8f63a4
--- /dev/null
+++ b/testsuite/tests/driver/1959/test.T
@@ -0,0 +1,5 @@
+test('1959',
+ extra_clean(['E.hi', 'E.o', 'E.hs', 'prog', 'compile.out',
+ 'B.hi', 'B.o', 'C.hi', 'C.o', 'D.hi', 'D.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory dotest'])