From 64c7c0953f3d27fee96163a85bbf688b6ab898c5 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 31 Oct 2015 17:13:32 +0000 Subject: [PATCH] * gnat.dg/discr45.adb: New test. From-SVN: r229630 --- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gnat.dg/discr45.adb | 44 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/discr45.adb diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85dff2ef2f7..d6956cf95ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-10-31 Eric Botcazou + + * gnat.dg/discr45.adb: New test. + 2015-10-31 Tom de Vries * gfortran.dg/assumed_type_2.f90: Update test. diff --git a/gcc/testsuite/gnat.dg/discr45.adb b/gcc/testsuite/gnat.dg/discr45.adb new file mode 100644 index 00000000000..0d0b4dc6926 --- /dev/null +++ b/gcc/testsuite/gnat.dg/discr45.adb @@ -0,0 +1,44 @@ +-- { dg-do run } +-- { dg-options "-O2 -gnatws" } + +procedure Discr45 is + + function Ident_Int (I : Integer) return Integer is + begin + return I; + end; + + procedure Proc (Signal : Boolean) is + + subtype Index is Integer range 1..10; + + type My_Arr is array (Index range <>) OF Integer; + + type Rec (D3 : Integer := Ident_Int(1)) is record + case D3 is + when -5..10 => C1 : My_Arr(D3..Ident_Int(11)); + when Others => C2 : Integer := Ident_Int(5); + end case; + end record; + + X : Rec; + + function Value return Rec; + pragma No_Inline (Value); + + function Value return Rec is + begin + return X; + end; + + begin + if X /= Value then + raise Constraint_Error; + elsif Signal then + raise Program_Error; + end if; + end; + +begin + Proc (True); +end; -- 2.30.2