summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-02 14:26:40 -0500
committerBen Gamari <ben@smart-cactus.org>2022-04-20 13:41:23 -0400
commit575454d08680801f927fe571c2a6f21600b258f1 (patch)
treeb6741a2169a2a3d86701ddf890b3ceb8042f817a
parente8e0955f7f330dbad5da8d669a4c24fc2953b0bd (diff)
downloadhaskell-wip/T21141.tar.gz
testsuite: Add testcase for #21141wip/T21141
-rw-r--r--testsuite/tests/codeGen/should_run/T21141.hs26
-rw-r--r--testsuite/tests/codeGen/should_run/all.T1
2 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T21141.hs b/testsuite/tests/codeGen/should_run/T21141.hs
new file mode 100644
index 0000000000..f972eca477
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T21141.hs
@@ -0,0 +1,26 @@
+{-# LANGUAGE BlockArguments #-}
+{-# LANGUAGE LambdaCase #-}
+
+module Main where
+
+import GHC.Prim.Exception
+import GHC.Exception.Type
+import Control.Exception
+import System.Mem
+
+main ::IO ()
+main = do
+ -- evaluate the CAF
+ evaluate raiseUnderflow
+ `catch` \case
+ Underflow -> pure ()
+ e -> putStrLn "Unexpected exception"
+
+ -- free it with buggy compiler
+ performGC
+
+ -- reuse it
+ evaluate raiseUnderflow
+ `catch` \case
+ Underflow -> pure ()
+ e -> putStrLn "Unexpected exception"
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 654db78d43..af3a91d026 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -216,6 +216,7 @@ test('CallConv', [when(unregisterised(), skip),
when(arch('x86_64'), extra_hc_opts('CallConv_x86_64.s')),
when(arch('aarch64'), extra_hc_opts('CallConv_aarch64.s'))],
compile_and_run, [''])
+test('T21141', normal, compile_and_run, [''])
test('T21186', normal, compile_and_run, [''])
test('T20640a', normal, compile_and_run, [''])
test('T20640b', normal, compile_and_run, [''])