aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2020-05-12 11:01:16 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-07 05:26:56 -0400
commit572fa852f2f5cba25f70fc49c9bf18493433617c (patch)
tree4dd1353b57cae90f7918293cfdba7e74aa3c109f
parent3a70a9811f2a6d49527dafc7d9bb928c162d382b (diff)
downloadgcc-572fa852f2f5cba25f70fc49c9bf18493433617c.zip
gcc-572fa852f2f5cba25f70fc49c9bf18493433617c.tar.gz
gcc-572fa852f2f5cba25f70fc49c9bf18493433617c.tar.bz2
[Ada] Ada2020: AI12-0198 potentially unevaluated components of arrays
gcc/ada/ * sem_util.adb (Is_Potentially_Unevaluated): Protect reading attribute Etype.
-rw-r--r--gcc/ada/sem_util.adb3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 9383c5f..d0bde334 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -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)))