public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1531] [Ada] Deferred constant considered as not preelaborable
@ 2022-07-06 13:31 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-06 13:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e5802d60130bd804663559471f9c5f3561dfab4d

commit r13-1531-ge5802d60130bd804663559471f9c5f3561dfab4d
Author: Yannick Moy <moy@adacore.com>
Date:   Thu Jun 16 14:14:56 2022 +0200

    [Ada] Deferred constant considered as not preelaborable
    
    Fix detection of non-preelaborable constructs for checking SPARK
    elaboration rules, which was tagging deferred constant declarations as
    not preelaborable.
    
    gcc/ada/
    
            * sem_util.adb (Is_Non_Preelaborable_Construct): Fix for
            deferred constants.

Diff:
---
 gcc/ada/sem_util.adb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 942a77a34f2..7b7566d96c7 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -18952,8 +18952,9 @@ package body Sem_Util is
                if Has_Init_Expression (Nod) then
                   Visit (Expression (Nod));
 
-               elsif not Has_Preelaborable_Initialization
-                           (Etype (Defining_Entity (Nod)))
+               elsif not Constant_Present (Nod)
+                 and then not Has_Preelaborable_Initialization
+                                (Etype (Defining_Entity (Nod)))
                then
                   raise Non_Preelaborable;
                end if;


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

only message in thread, other threads:[~2022-07-06 13:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 13:31 [gcc r13-1531] [Ada] Deferred constant considered as not preelaborable Pierre-Marie de Rodat

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