aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2024-01-04 14:18:04 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-07 09:55:53 +0200
commit41ebf2e641f85560452cb4cea35a7f3f013982bc (patch)
tree84f457bd65c1c5488f093cf156b8fa59e7edba57 /gcc/ada
parentd82909fed0a90a2950e2413429efce655ecba8d2 (diff)
downloadgcc-41ebf2e641f85560452cb4cea35a7f3f013982bc.zip
gcc-41ebf2e641f85560452cb4cea35a7f3f013982bc.tar.gz
gcc-41ebf2e641f85560452cb4cea35a7f3f013982bc.tar.bz2
ada: Fix missing flag for GNATprove
GNATprove expects the frontend to position correctly range check flags, on expressions which might lead to a range check failure. This was missing on in-out parameters of calls. Now fixed. There is no impact on compilation. gcc/ada/ * sem_res.adb (Resolve_Actuals): Add range check flag.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_res.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 67062c6..dc48b0b 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4388,6 +4388,17 @@ package body Sem_Res is
Resolve (Expression (A));
end if;
+ -- In GNATprove mode, add a range check flag on scalar
+ -- conversions for IN OUT parameters. The check may be
+ -- needed on entry from the call.
+
+ if GNATprove_Mode
+ and then Ekind (F) = E_In_Out_Parameter
+ and then Is_Scalar_Type (Etype (F))
+ then
+ Set_Do_Range_Check (Expression (A));
+ end if;
+
-- If the actual is a function call that returns a limited
-- unconstrained object that needs finalization, create a
-- transient scope for it, so that it can receive the proper