From: Yannick Moy Date: Wed, 27 May 2020 14:46:27 +0000 (+0200) Subject: [Ada] Fix detection of volatile properties in SPARK X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c3026d451dacabecc7ff42b5b81deaf420d758aa;p=gcc.git [Ada] Fix detection of volatile properties in SPARK gcc/ada/ * sem_util.adb (Has_Enabled_Property): Add handling of non-variable objects. --- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b70f2c8fcbb..4b4f4af3754 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -11537,6 +11537,14 @@ package body Sem_Util is elsif Ekind (Item_Id) = E_Variable then return Type_Or_Variable_Has_Enabled_Property (Item_Id); + -- Other objects can only inherit properties through their type. We + -- cannot call directly Type_Or_Variable_Has_Enabled_Property on + -- these as they don't have contracts attached, which is expected by + -- this function. + + elsif Is_Object (Item_Id) then + return Type_Or_Variable_Has_Enabled_Property (Etype (Item_Id)); + elsif Is_Type (Item_Id) then return Type_Or_Variable_Has_Enabled_Property (Item_Id => First_Subtype (Item_Id));