view gcc/testsuite/gnat.dg/overflow_fixed.adb @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children
line wrap: on
line source

-- { 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;