When loading of renamed child unit failed, we didn't properly restore
the value of a global Parsing_Main_Extended_Source variable.

This is primarily a cleanup change; behaviour is not affected (perhaps
except for errors reported on complicated code that is illegal anyway).

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

gcc/ada/

        * lib-load.adb (Load): Replace early return with goto to properly
        restore context on failure.
diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb
--- a/gcc/ada/lib-load.adb
+++ b/gcc/ada/lib-load.adb
@@ -451,8 +451,8 @@ package body Lib.Load is
               With_Node  => With_Node);
 
          if Unump = No_Unit then
-            Parsing_Main_Extended_Source := Save_PMES;
-            return No_Unit;
+            Unum := No_Unit;
+            goto Done;
          end if;
 
          --  If parent is a renaming, then we use the renamed package as


Reply via email to