public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/ranger] [Ada] Fix premature freezing of artificial array subtype
@ 2020-06-17 22:52 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2020-06-17 22:52 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:7e7cb6eee494e3ec59ae1faf679fe2c3a578a95e

commit 7e7cb6eee494e3ec59ae1faf679fe2c3a578a95e
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Apr 7 09:39:06 2020 +0200

    [Ada] Fix premature freezing of artificial array subtype
    
    2020-06-16  Eric Botcazou  <ebotcazou@adacore.com>
    
    gcc/ada/
    
            * freeze.adb (Freeze_Expression): Stop climbing the parent chain
            at a N_{Case,If}_Expression node for a type or an entity that
            does not come from source.

Diff:
---
 gcc/ada/freeze.adb | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 8723af33edf..47a063ae043 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -7630,15 +7630,18 @@ package body Freeze is
                      exit;
                   end if;
 
-               --  Note: N_Loop_Statement is a special case. A type that
-               --  appears in the source can never be frozen in a loop (this
-               --  occurs only because of a loop expanded by the expander), so
-               --  we keep on going. Otherwise we terminate the search. Same
-               --  is true of any entity which comes from source. (if they
-               --  have predefined type, that type does not appear to come
-               --  from source, but the entity should not be frozen here).
-
-               when N_Loop_Statement =>
+               --  N_Loop_Statement is a special case: a type that appears in
+               --  the source can never be frozen in a loop (this occurs only
+               --  because of a loop expanded by the expander), so we keep on
+               --  going. Otherwise we terminate the search. Same is true of
+               --  any entity which comes from source (if it has a predefined
+               --  type, this type does not appear to come from source, but the
+               --  entity should not be frozen here). The reasoning can also be
+               --  applied to if-expressions and case-expressions.
+
+               when N_Loop_Statement
+                  | N_If_Expression
+                  | N_Case_Expression =>
                   exit when not Comes_From_Source (Etype (N))
                     and then (No (Nam) or else not Comes_From_Source (Nam));


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

only message in thread, other threads:[~2020-06-17 22:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 22:52 [gcc/devel/ranger] [Ada] Fix premature freezing of artificial array subtype Aldy Hernandez

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).