aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-06-02 02:57:11 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-15 09:42:39 -0400
commitfa02302bc17def4530df18fd5d77d0236cacb395 (patch)
tree1184035c6b78427ff37e10a5cd37e07643ddb373 /gcc
parent5f9afe0dc1c06cd7b004280d84e4cb31c8616894 (diff)
downloadgcc-fa02302bc17def4530df18fd5d77d0236cacb395.zip
gcc-fa02302bc17def4530df18fd5d77d0236cacb395.tar.gz
gcc-fa02302bc17def4530df18fd5d77d0236cacb395.tar.bz2
[Ada] Potential access to uninitialized variable
gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure Typ is never accessed uninitialized.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_aggr.adb4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 31496be..d2419d9 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2677,7 +2677,7 @@ package body Sem_Aggr is
Ent : Entity_Id;
Expr : Node_Id;
Id : Entity_Id;
- Typ : Entity_Id;
+ Typ : Entity_Id := Empty;
begin
if Present (Iterator_Specification (Comp)) then
@@ -2727,7 +2727,9 @@ package body Sem_Aggr is
-- expression will reference the internal (synonym) loop variable.
Enter_Name (Id);
+
if No (Key_Type) then
+ pragma Assert (Present (Typ));
Set_Etype (Id, Typ);
else
Set_Etype (Id, Key_Type);