summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-02 14:26:40 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-04-25 10:18:54 -0400
commit9587726f53e51e429bdb8d8ca11f9de4d0902b77 (patch)
tree7a4c3213f8eea7871adb7a1616761f7fae643013
parente7c4719d8990a58abd9073731a36922a843ba797 (diff)
downloadhaskell-9587726f53e51e429bdb8d8ca11f9de4d0902b77.tar.gz
testsuite: Add testcase for #21141
-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, [''])