diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-02-06 13:08:37 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-11 05:10:04 -0500 |
commit | aba51b65863db5f2687f29d10ba24ffa49dabd3b (patch) | |
tree | dc82a63a7423f54d37917e72ffea8cbd03360bc7 /testsuite/tests/primops | |
parent | b75e7486de73868e6821a9f680e9e13794dff15c (diff) | |
download | haskell-aba51b65863db5f2687f29d10ba24ffa49dabd3b.tar.gz |
Add arithmetic exception primops (#14664)
Diffstat (limited to 'testsuite/tests/primops')
-rw-r--r-- | testsuite/tests/primops/should_run/T14664.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/primops/should_run/T14664.stdout | 3 | ||||
-rw-r--r-- | testsuite/tests/primops/should_run/all.T | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/primops/should_run/T14664.hs b/testsuite/tests/primops/should_run/T14664.hs new file mode 100644 index 0000000000..4c29d327d0 --- /dev/null +++ b/testsuite/tests/primops/should_run/T14664.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE MagicHash #-} + +module Main where + +import GHC.Exts +import Control.Exception + +main :: IO () +main = do + + let + printE :: ArithException -> IO () + printE = print + + catch (raiseUnderflow# void#) printE + catch (raiseOverflow# void#) printE + catch (raiseDivZero# void#) printE diff --git a/testsuite/tests/primops/should_run/T14664.stdout b/testsuite/tests/primops/should_run/T14664.stdout new file mode 100644 index 0000000000..35e798039c --- /dev/null +++ b/testsuite/tests/primops/should_run/T14664.stdout @@ -0,0 +1,3 @@ +arithmetic underflow +arithmetic overflow +divide by zero diff --git a/testsuite/tests/primops/should_run/all.T b/testsuite/tests/primops/should_run/all.T index bbcbdd8f78..16579207fa 100644 --- a/testsuite/tests/primops/should_run/all.T +++ b/testsuite/tests/primops/should_run/all.T @@ -28,3 +28,4 @@ test('CmpInt16', normal, compile_and_run, ['']) test('CmpWord16', normal, compile_and_run, ['']) test('ShrinkSmallMutableArrayA', normal, compile_and_run, ['']) test('ShrinkSmallMutableArrayB', normal, compile_and_run, ['']) +test('T14664', normal, compile_and_run, ['']) |