summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/fp_exception.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg/fp_exception.adb')
-rw-r--r--gcc/testsuite/gnat.dg/fp_exception.adb24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/fp_exception.adb b/gcc/testsuite/gnat.dg/fp_exception.adb
new file mode 100644
index 0000000000..a8bf62fa92
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/fp_exception.adb
@@ -0,0 +1,24 @@
+-- { dg-do run { target *-*-solaris2.* } }
+-- { dg-options "-ftrapping-math" }
+
+procedure FP_Exception is
+
+ type my_fixed is digits 15;
+ for my_fixed'size use 64;
+ fixed1 : my_fixed := 1.0;
+ fixed2 : my_fixed := -0.0;
+ mask_all : constant integer := 16#1F#;
+
+ procedure fpsetmask(mask : in integer);
+ pragma IMPORT (C, fpsetmask, "fpsetmask");
+
+begin
+
+ -- Mask all floating point exceptions so they can be trapped
+ fpsetmask (mask_all);
+
+ fixed1 := fixed1 / fixed2;
+
+exception
+ when others => null;
+end;