[Ada] Unnesting: improve handling of bounds for formal parameters
authorEd Schonberg <schonberg@adacore.com>
Mon, 11 Jun 2018 09:15:03 +0000 (09:15 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 11 Jun 2018 09:15:03 +0000 (09:15 +0000)
2018-06-11  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* exp_unst.adb (Visit_Node): Check reference to formal parameter of
current procedure, because the bounds of its type may be uplevel
references.

From-SVN: r261394

gcc/ada/ChangeLog
gcc/ada/exp_unst.adb

index 6b883b9dd3a944ce04ec0c845dc12337925d828e..ea2c131bf23075cb6e61fce550b49772ea6949fc 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-11  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_unst.adb (Visit_Node): Check reference to formal parameter of
+       current procedure, because the bounds of its type may be uplevel
+       references.
+
 2018-06-02  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: If this is
index c6d49e08f7d2c66402a36dfec14e43e5c55d9166..b38f2b6d17fac3169392b98dde250a048eaae924 100644 (file)
@@ -999,6 +999,20 @@ package body Exp_Unst is
                           and then not Is_Static_Type (Ent)
                         then
                            Note_Uplevel_Ref (Ent, N, Caller, Callee);
+
+                        --  Check the type of a formal parameter of the current
+                        --  subprogram, whose formal type may be an uplevel
+                        --  reference.
+
+                        elsif Is_Formal (Ent)
+                          and then Scope (Ent) = Current_Subprogram
+                        then
+                           declare
+                              DT : Boolean := False;
+
+                           begin
+                              Check_Static_Type (Etype (Ent), Empty, DT);
+                           end;
                         end if;
                      end if;
                   end if;