From aba51b65863db5f2687f29d10ba24ffa49dabd3b Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Thu, 6 Feb 2020 13:08:37 +0100 Subject: Add arithmetic exception primops (#14664) --- testsuite/tests/primops/should_run/T14664.hs | 17 +++++++++++++++++ testsuite/tests/primops/should_run/T14664.stdout | 3 +++ testsuite/tests/primops/should_run/all.T | 1 + 3 files changed, 21 insertions(+) create mode 100644 testsuite/tests/primops/should_run/T14664.hs create mode 100644 testsuite/tests/primops/should_run/T14664.stdout (limited to 'testsuite/tests/primops') 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, ['']) -- cgit v1.2.1