]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Prevent infinite recursion when there is no expected unit
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 26 May 2021 13:05:28 +0000 (15:05 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 8 Jul 2021 13:34:19 +0000 (13:34 +0000)
gcc/ada/

* par-load.adb (Load): Don't remove unit, but flag it as
erroneous and return.

gcc/ada/par-load.adb

index 0773f36946fd7f22702f759ad8b40796ef0edf8f..6079fa477f6bd726ae4bc3258d6c470a2ca83fcc 100644 (file)
@@ -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