| 1 |
-- { dg-do run { target *-*-solaris2.* } } |
| 2 |
-- { dg-options "-ftrapping-math" } |
| 3 |
|
| 4 |
procedure FP_Exception is |
| 5 |
|
| 6 |
type my_fixed is digits 15; |
| 7 |
for my_fixed'size use 64; |
| 8 |
fixed1 : my_fixed := 1.0; |
| 9 |
fixed2 : my_fixed := -0.0; |
| 10 |
mask_all : constant integer := 16#1F#; |
| 11 |
|
| 12 |
procedure fpsetmask(mask : in integer); |
| 13 |
pragma IMPORT (C, fpsetmask, "fpsetmask"); |
| 14 |
|
| 15 |
begin |
| 16 |
|
| 17 |
-- Mask all floating point exceptions so they can be trapped |
| 18 |
fpsetmask (mask_all); |
| 19 |
|
| 20 |
fixed1 := fixed1 / fixed2; |
| 21 |
|
| 22 |
exception |
| 23 |
when others => null; |
| 24 |
end; |