]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Ada2020: AI12-0198 potentially unevaluated components of arrays
authorJavier Miranda <miranda@adacore.com>
Tue, 12 May 2020 15:01:16 +0000 (11:01 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 7 Jul 2020 09:26:56 +0000 (05:26 -0400)
gcc/ada/

* sem_util.adb (Is_Potentially_Unevaluated): Protect reading
attribute Etype.

gcc/ada/sem_util.adb

index 9383c5f6d0df46939dc3c37c81305289975e7357..d0bde3344f804e1177262184ba5c0a4c120fe067 100644 (file)
@@ -17805,6 +17805,8 @@ package body Sem_Util is
                                N_Or_Else,
                                N_Quantified_Expression)
         and then not (Nkind (Par) = N_Aggregate
+                        and then Present (Etype (Par))
+                        and then Etype (Par) /= Any_Composite
                         and then Is_Array_Type (Etype (Par)))
       loop
          Expr := Par;
@@ -17871,6 +17873,7 @@ package body Sem_Util is
                   return True;
 
                elsif Nkind (Choice) = N_Identifier
+                 and then Present (Etype (Choice))
                  and then Present (Scalar_Range (Etype (Choice)))
                  and then
                    Non_Static_Or_Null_Range (Scalar_Range (Etype (Choice)))