From fa02302bc17def4530df18fd5d77d0236cacb395 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 2 Jun 2020 02:57:11 -0400 Subject: [PATCH] [Ada] Potential access to uninitialized variable gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure Typ is never accessed uninitialized. --- gcc/ada/sem_aggr.adb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 31496bee1dd..d2419d9bde5 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); -- 2.30.2