ubuntu-buildroot/output/build/host-gcc-initial-11.4.0/gcc/testsuite/gnat.dg/overflow_fixed.adb

20 lines
365 B
Ada

-- { dg-do run }
-- { dg-options "-gnato -O" }
procedure Overflow_Fixed is
type Unsigned_8_Bit is mod 2**8;
procedure Fixed_To_Eight (Value : Duration) is
Item : Unsigned_8_Bit;
begin
Item := Unsigned_8_Bit(Value);
raise Program_Error;
exception
when Constraint_Error => null; -- expected case
end;
begin
Fixed_To_Eight (-0.5);
end;