diff --git a/testsuite/tests/codeGen/should_run/T21141.hs b/testsuite/tests/codeGen/should_run/T21141.hs new file mode 100644 index 0000000000000000000000000000000000000000..f972eca4774b3a38c39c72552ce1fc91b0a27dd3 --- /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 654db78d43e1bbdeba2a5251657ac5fa75fdbf74..af3a91d02645cbe4507a72684dd0343a27e99fe5 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, [''])