]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Plug loophole in handling of No_Raise pragma
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 15 Jul 2024 20:29:06 +0000 (22:29 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 2 Aug 2024 07:08:09 +0000 (09:08 +0200)
Unlike the aspect, the pragma needs to be propagated explicitly from a
generic subprogram to its instances.

gcc/ada/

* sem_ch12.adb (Analyze_Subprogram_Instantiation): Propagate the
No_Raise flag like the No_Return flag.

gcc/ada/sem_ch12.adb

index 6b98343aeebea881d14d23b162998682764474df..25821cb769544aa86996306c2d4a07ba96e52305 100644 (file)
@@ -6069,9 +6069,16 @@ package body Sem_Ch12 is
          Set_Has_Pragma_No_Inline
            (Anon_Id,     Has_Pragma_No_Inline (Gen_Unit));
 
-         --  Propagate No_Return if pragma applied to generic unit. This must
-         --  be done explicitly because pragma does not appear in generic
-         --  declaration (unlike the aspect case).
+         --  Propagate No_Raise if pragma applied to generic unit. This must
+         --  be done explicitly because the pragma does not appear in generic
+         --  declarations (unlike the aspect).
+
+         if No_Raise (Gen_Unit) then
+            Set_No_Raise (Act_Decl_Id);
+            Set_No_Raise (Anon_Id);
+         end if;
+
+         --  Likewise for No_Return
 
          if No_Return (Gen_Unit) then
             Set_No_Return (Act_Decl_Id);