From: Yannick Moy Date: Thu, 16 Jun 2022 12:14:56 +0000 (+0200) Subject: [Ada] Deferred constant considered as not preelaborable X-Git-Tag: basepoints/gcc-14~5676 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5802d60130bd804663559471f9c5f3561dfab4d;p=thirdparty%2Fgcc.git [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 --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;