aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/contracts.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-11-14 16:12:04 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-30 09:16:20 -0500
commitc1a69c98717d9c63ffde67746c56243d530c9109 (patch)
tree6767fb0010c1feca3ca5dc51413a51a2111d56e5 /gcc/ada/contracts.adb
parentf7937111e8c8cfaf5ea79d97c65d6b6dc29b261f (diff)
downloadgcc-c1a69c98717d9c63ffde67746c56243d530c9109.zip
gcc-c1a69c98717d9c63ffde67746c56243d530c9109.tar.gz
gcc-c1a69c98717d9c63ffde67746c56243d530c9109.tar.bz2
[Ada] Fix internal error on extended return and fixed-point result
gcc/ada/ * contracts.adb (Check_Type_Or_Object_External_Properties): Make sure to exclude all return objects from the SPARK legality rule on effectively volatile variables. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Use the fast track only when the declaration of the return object can be dropped.
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r--gcc/ada/contracts.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 1b15d99f..7387ffe 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -905,9 +905,12 @@ package body Contracts is
-- The following checks are relevant only when SPARK_Mode is on, as
-- they are not standard Ada legality rules. Internally generated
- -- temporaries are ignored.
+ -- temporaries are ignored, as well as return objects.
- if SPARK_Mode = On and then Comes_From_Source (Type_Or_Obj_Id) then
+ if SPARK_Mode = On
+ and then Comes_From_Source (Type_Or_Obj_Id)
+ and then not Is_Return_Object (Type_Or_Obj_Id)
+ then
if Is_Effectively_Volatile (Type_Or_Obj_Id) then
-- The declaration of an effectively volatile object or type must