From c1a69c98717d9c63ffde67746c56243d530c9109 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 14 Nov 2020 16:12:04 +0100 Subject: [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. --- gcc/ada/contracts.adb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/ada/contracts.adb') 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 -- cgit v1.1