public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1451] [Ada] Add more initialization of Stored_Constraint
Date: Tue, 15 Jun 2021 10:20:45 +0000 (GMT)	[thread overview]
Message-ID: <20210615102045.F1EA4398B15E@sourceware.org> (raw)

https://gcc.gnu.org/g:44d27e8e735855216d21d6fca80473f56a69b698

commit r12-1451-g44d27e8e735855216d21d6fca80473f56a69b698
Author: Richard Kenner <kenner@adacore.com>
Date:   Sun Feb 14 08:02:19 2021 -0500

    [Ada] Add more initialization of Stored_Constraint
    
    gcc/ada/
    
            * sem_ch3.adb (Array_Type_Declaration, Build_Derived_Type):
            Reinitialize Stored_Constraint when needed.
            (Set_Modular_Size): Likewise.
            * atree.adb: (Check_Vanishing_Fields): Add node id to debugging
            information.

Diff:
---
 gcc/ada/atree.adb   |  6 ++++--
 gcc/ada/sem_ch3.adb | 17 +++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 541655c466f..d0b06bbce5e 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -772,7 +772,8 @@ package body Atree is
                   Write_Str (New_Kind'Img);
                   Write_Str (" Nonzero field ");
                   Write_Str (F'Img);
-                  Write_Str (" is vanishing");
+                  Write_Str (" is vanishing for node ");
+                  Write_Int (Nat (Old_N));
                   Write_Eol;
 
                   raise Program_Error;
@@ -845,7 +846,8 @@ package body Atree is
                   Write_Str (New_Kind'Img);
                   Write_Str (" Nonzero field ");
                   Write_Str (F'Img);
-                  Write_Str (" is vanishing ");
+                  Write_Str (" is vanishing for node ");
+                  Write_Int (Nat (Old_N));
                   Write_Eol;
 
                   if New_Kind = E_Void or else Old_Kind = E_Void then
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index f67c40ed466..1eac9057c41 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -6191,6 +6191,12 @@ package body Sem_Ch3 is
 
       if Nkind (Def) = N_Constrained_Array_Definition then
 
+         if Ekind (T) in Incomplete_Or_Private_Kind then
+            Reinit_Field_To_Zero (T, Stored_Constraint);
+         else
+            pragma Assert (Ekind (T) = E_Void);
+         end if;
+
          --  Establish Implicit_Base as unconstrained base type
 
          Implicit_Base := Create_Itype (E_Array_Type, P, Related_Id, 'B');
@@ -9749,6 +9755,12 @@ package body Sem_Ch3 is
    begin
       --  Set common attributes
 
+      if Ekind (Derived_Type) in Incomplete_Or_Private_Kind
+        and then Ekind (Parent_Base) in Modular_Integer_Kind | Array_Kind
+      then
+         Reinit_Field_To_Zero (Derived_Type, Stored_Constraint);
+      end if;
+
       Set_Scope                  (Derived_Type, Current_Scope);
       Set_Etype                  (Derived_Type,        Parent_Base);
       Mutate_Ekind               (Derived_Type, Ekind (Parent_Base));
@@ -19618,6 +19630,11 @@ package body Sem_Ch3 is
       --  Proceed with analysis of mod expression
 
       Analyze_And_Resolve (Mod_Expr, Any_Integer);
+
+      if Ekind (T) in Incomplete_Or_Private_Kind then
+         Reinit_Field_To_Zero (T, Stored_Constraint);
+      end if;
+
       Set_Etype (T, T);
       Mutate_Ekind (T, E_Modular_Integer_Type);
       Init_Alignment (T);


                 reply	other threads:[~2021-06-15 10:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210615102045.F1EA4398B15E@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).