public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] [Ada] Potential access to uninitialized variable
@ 2020-08-22 23:41 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 23:41 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:25af22068940bfac72aab8c68e3bd9200e90b7bc

commit 25af22068940bfac72aab8c68e3bd9200e90b7bc
Author: Arnaud Charlet <charlet@adacore.com>
Date:   Tue Jun 2 02:57:11 2020 -0400

    [Ada] Potential access to uninitialized variable
    
    gcc/ada/
    
            * sem_aggr.adb (Resolve_Iterated_Component_Association): Ensure
            Typ is never accessed uninitialized.

Diff:
---
 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-22 23:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 23:41 [gcc/devel/autopar_devel] [Ada] Potential access to uninitialized variable Giuliano Belinassi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).