* gnat.dg/opt62.adb: New test.
* gnat.dg/opt62_pkg.ads: New helper.
From-SVN: r244485
+2017-01-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt62.adb: New test.
+ * gnat.dg/opt62_pkg.ads: New helper.
+
2017-01-14 Bernd Schmidt <bschmidt@redhat.com>
PR rtl-optimization/78626
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Opt62_Pkg; use Opt62_Pkg;
+
+procedure Opt62 is
+
+ String5 : String(1..5) := "12345";
+ D: Der := (Unconstrained_Der with D2 => 5, S2 => String5);
+
+begin
+ if D.Str1 /= "abcde" then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+package Opt62_Pkg is
+
+ Default_String : constant String := "This is a default string";
+
+ subtype Length is Natural range 0..255;
+
+ type Root (D1 : Length) is tagged record
+ S1 : String(1..D1) := Default_String(1..D1);
+ end record;
+
+ type Unconstrained_Der is new Root with record
+ Str1 : String(1..5) := "abcde";
+ end record;
+
+ type Der (D2 : Length) is new Unconstrained_Der (D1 => 10) with record
+ S2 : String(1..D2);
+ end record;
+
+end Opt62_Pkg;