[commit: ghc] ghc-8.4: Add testcase for #14251 (c55f45d)

git at git.haskell.org git at git.haskell.org
Mon Oct 8 21:32:43 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.4
Link       : http://ghc.haskell.org/trac/ghc/changeset/c55f45d500a3ceaf06802de364da281ecbb582e4/ghc

>---------------------------------------------------------------

commit c55f45d500a3ceaf06802de364da281ecbb582e4
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Sep 19 15:04:11 2018 -0400

    Add testcase for #14251
    
    (cherry picked from commit ba086ca72ee6c77abba685f3100ad513e38a1a87)


>---------------------------------------------------------------

c55f45d500a3ceaf06802de364da281ecbb582e4
 testsuite/tests/codeGen/should_run/T14251.hs       | 27 ++++++++++++++++++++++
 .../should_run/{T6084.stdout => T14251.stdout}     |  3 ++-
 testsuite/tests/codeGen/should_run/all.T           |  3 +++
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/testsuite/tests/codeGen/should_run/T14251.hs b/testsuite/tests/codeGen/should_run/T14251.hs
new file mode 100644
index 0000000..d31498e
--- /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/T6084.stdout b/testsuite/tests/codeGen/should_run/T14251.stdout
similarity index 54%
copy from testsuite/tests/codeGen/should_run/T6084.stdout
copy to testsuite/tests/codeGen/should_run/T14251.stdout
index 8baa6e3..de80321 100644
--- a/testsuite/tests/codeGen/should_run/T6084.stdout
+++ b/testsuite/tests/codeGen/should_run/T14251.stdout
@@ -1,3 +1,4 @@
 Hello World!
 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 55386e4..6bc19a1 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -173,3 +173,6 @@ test('T13825-unit',
      ['-package ghc'])
 test('T14619', normal, compile_and_run, [''])
 test('T14754', normal, compile_and_run, [''])
+test('T14251', [extra_ways(['llvm', 'optllvm']),
+                expect_broken_for(14251, ['optllvm'])],
+     compile_and_run, [''])



More information about the ghc-commits mailing list