]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Tune check for restriction No_Relative_Delay and call to Set_Handler
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 3 Jul 2025 08:10:56 +0000 (10:10 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 22 Jul 2025 08:35:14 +0000 (10:35 +0200)
When checking restriction No_Relative_Delay and detecting calls to
Ada.Real_Time.Timing_Events.Set_Handler with a Time_Span parameter,
we looked at the exact type of the actual parameter, while we should
look at its base type.

This patch looks at the type of actual parameter like it is done in
Expand_N_Delay_Until_Statement.

gcc/ada/ChangeLog:

* sem_res.adb (Resolve_Call): Look at the base type of actual parameter
when checking call to Set_Handler.

gcc/ada/sem_res.adb

index e44994a681d79b0ef30a86852856df615e0382fb..29b77668802396cb2ec87d1b40ac26dd65a1b91a 100644 (file)
@@ -7270,7 +7270,9 @@ package body Sem_Res is
 
       if Restriction_Check_Required (No_Relative_Delay)
         and then Is_RTE (Nam, RE_Set_Handler)
-        and then Is_RTE (Etype (Next_Actual (First_Actual (N))), RE_Time_Span)
+        and then
+          Is_RTE
+            (Base_Type (Etype (Next_Actual (First_Actual (N)))), RE_Time_Span)
       then
          Check_Restriction (No_Relative_Delay, N);
       end if;