Code cleanup, both to improve efficiency (when no error has been posted
for a subprogram call) and to avoid potential crashes (when an error has
been posted and the subprogram call parameters are likely to be
ill-formed as well).

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * sem_warn.adb (Warn_On_Overlapping_Actuals): Prevent cascaded
        errors once for the subprogram call, not for every pair of
        actual parameters.
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -3729,6 +3729,11 @@ package body Sem_Warn is
 
       if Nkind (N) not in N_Subprogram_Call | N_Entry_Call_Statement then
          return;
+
+      --  Guard against previous errors
+
+      elsif Error_Posted (N) then
+         return;
       end if;
 
       --  If a call C has two or more parameters of mode in out or out that are
@@ -3800,10 +3805,9 @@ package body Sem_Warn is
                   and then Is_Composite_Type (Etype (Form1)))
                then
 
-               --  Guard against previous errors
+                  --  Guard against previous errors
 
-                  if Error_Posted (N)
-                    or else No (Etype (Act1))
+                  if No (Etype (Act1))
                     or else No (Etype (Act2))
                   then
                      null;


Reply via email to