aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/overflow_fixed.adb
blob: 6ece51523339e282a1464396bbd12a80210eb0ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- { 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;