aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2020-05-27 16:46:27 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:17:11 -0300
commit5493032c5ffde0f2abe633702fdc60c783393f47 (patch)
treeb29bfbfda7032e5833e7591eef0a3699c2ab69c7
parentde2f3677a5a180b58f1b743e7fc3be7b41c5a2af (diff)
downloadgcc-5493032c5ffde0f2abe633702fdc60c783393f47.zip
gcc-5493032c5ffde0f2abe633702fdc60c783393f47.tar.gz
gcc-5493032c5ffde0f2abe633702fdc60c783393f47.tar.bz2
[Ada] Fix detection of volatile properties in SPARK
gcc/ada/ * sem_util.adb (Has_Enabled_Property): Add handling of non-variable objects.
-rw-r--r--gcc/ada/sem_util.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b70f2c8..4b4f4af 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));