From 62aae315f680f2205d474ff3ebcb1756a707f715 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Wed, 26 May 2021 15:05:28 +0200 Subject: [PATCH] [Ada] Prevent infinite recursion when there is no expected unit gcc/ada/ * par-load.adb (Load): Don't remove unit, but flag it as erroneous and return. --- gcc/ada/par-load.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb index 0773f36946fd..6079fa477f6b 100644 --- a/gcc/ada/par-load.adb +++ b/gcc/ada/par-load.adb @@ -234,9 +234,10 @@ begin Error_Msg ("\\found unit $!", Loc); end if; - -- In both cases, remove the unit so that it is out of the way later + -- In both cases, flag the fatal error and give up - Remove_Unit (Cur_Unum); + Set_Fatal_Error (Cur_Unum, Error_Detected); + return; end if; -- If current unit is a body, load its corresponding spec -- 2.47.3