summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-09-19 15:04:11 -0400
committerBen Gamari <ben@smart-cactus.org>2018-09-20 10:13:55 -0400
commitba086ca72ee6c77abba685f3100ad513e38a1a87 (patch)
tree6345ff2cacee2b7a668f91c52e85020c952146ee /testsuite/tests/codeGen
parent4e3f6a0767b57dfa54934eb4fdb27f54db7016ee (diff)
downloadhaskell-ba086ca72ee6c77abba685f3100ad513e38a1a87.tar.gz
Add testcase for #14251
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_run/T14251.hs27
-rw-r--r--testsuite/tests/codeGen/should_run/T14251.stdout4
-rw-r--r--testsuite/tests/codeGen/should_run/all.T3
3 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T14251.hs b/testsuite/tests/codeGen/should_run/T14251.hs
new file mode 100644
index 0000000000..d31498efe4
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T14251.hs
@@ -0,0 +1,27 @@
+{-# LANGUAGE MagicHash, BangPatterns #-}
+module Main where
+
+import GHC.Exts
+
+{-# NOINLINE f #-}
+f :: (Int# -> Float# -> Double# -> Float# -> Double# -> String) -> String
+f g = g 3# 4.0# 5.0## 6.0# 6.9## ++ " World!"
+
+{-# NOINLINE p #-}
+p :: Int# -> Float# -> Double# -> Float# -> Double# -> String
+p i j k l m = "Hello"
+
+{-# NOINLINE q #-}
+q :: Int# -> Int# -> Float# -> Double# -> Float# -> Double# -> String
+q _ i j k l m = "Hello " ++ show (F# l) ++ " " ++ show (D# m)
+
+{-# NOINLINE r #-}
+r :: Int# -> Float# -> Double# -> Float# -> Double# -> String
+r i = let !(I# z) = length [I# 1# .. I# i] in \j k l m -> p z j k l m
+ -- ghc won't eta-expand around the length, because it has unknown cost
+
+main = do
+ putStrLn (f p) -- fast call
+ putStrLn (f r) -- slow call: function but wrong arity
+ let g = last [q 1#]
+ putStrLn (f g) -- slow call: thunk
diff --git a/testsuite/tests/codeGen/should_run/T14251.stdout b/testsuite/tests/codeGen/should_run/T14251.stdout
new file mode 100644
index 0000000000..de803214d4
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T14251.stdout
@@ -0,0 +1,4 @@
+Hello World!
+Hello World!
+Hello 6.0 6.9 World!
+
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 60f86d766f..025acb4244 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -172,3 +172,6 @@ test('T13825-unit',
test('T14619', normal, compile_and_run, [''])
test('T14754', normal, compile_and_run, [''])
test('T14346', only_ways(['threaded1','threaded2']), compile_and_run, ['-O -threaded'])
+test('T14251', [extra_ways(['llvm', 'optllvm']),
+ expect_broken_for(14251, ['optllvm'])],
+ compile_and_run, [''])