diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2023-06-16 08:34:27 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-07-28 09:28:12 +0200 |
commit | cb3bed6018acae828f7a4828678c017c95f695f4 (patch) | |
tree | 6ae29cf6d7b7e6cfd29575d002eb0bba63967808 | |
parent | 1d6af545bf7fa34c9bdd17b41e81abd019d073a8 (diff) | |
download | gcc-cb3bed6018acae828f7a4828678c017c95f695f4.zip gcc-cb3bed6018acae828f7a4828678c017c95f695f4.tar.gz gcc-cb3bed6018acae828f7a4828678c017c95f695f4.tar.bz2 |
ada: Improve defense against illegal code in check for infinite loops
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.
-rw-r--r-- | gcc/ada/sem_warn.adb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 5dd7c17..7ecb4d9 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -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); |