]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Improve defense against illegal code in check for infinite loops
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 16 Jun 2023 06:34:27 +0000 (08:34 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 28 Jul 2023 07:28:12 +0000 (09:28 +0200)
Fix crash occurring when attribute System'To_Address is used without
a WITH clause for package System.

gcc/ada/

* sem_warn.adb (Check_Infinite_Loop_Warning): Don't look at the type of
actual parameter when it has no type at all, e.g. because the entire
subprogram call is illegal.

gcc/ada/sem_warn.adb

index 5dd7c17d4e29e0b4968536e7676971dacdacf0f4..7ecb4d9c4a6710cb64252fd6eba96b428837c047 100644 (file)
@@ -591,7 +591,9 @@ package body Sem_Warn is
             begin
                Actual := First_Actual (N);
                while Present (Actual) loop
-                  if Is_Access_Subprogram_Type (Etype (Actual)) then
+                  if No (Etype (Actual))
+                    or else Is_Access_Subprogram_Type (Etype (Actual))
+                  then
                      return Abandon;
                   else
                      Next_Actual (Actual);