aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@adacore.com>2021-11-22 17:38:50 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-12-02 16:26:23 +0000
commiteccc7c8cbfda3d8b6210543127b000d028631b6b (patch)
tree1b0f72b906c94ee360b74a3b57d3b140284a756c /gcc
parentea7f9e0530251152b5e6a99f36515032f318c4d1 (diff)
downloadgcc-eccc7c8cbfda3d8b6210543127b000d028631b6b.zip
gcc-eccc7c8cbfda3d8b6210543127b000d028631b6b.tar.gz
gcc-eccc7c8cbfda3d8b6210543127b000d028631b6b.tar.bz2
[Ada] Don't allow entry in implicit with chain to be ghost
gcc/ada/ * rtsfind.adb (Maybe_Add_With): Ensure that the added "with" is never marked as ignored ghost code.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/rtsfind.adb14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 5a89076..0c3a043 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -1248,9 +1248,10 @@ package body Rtsfind is
-- for this unit to the current compilation unit.
declare
- LibUnit : constant Node_Id := Unit (Cunit (U.Unum));
- Clause : Node_Id;
- Withn : Node_Id;
+ LibUnit : constant Node_Id := Unit (Cunit (U.Unum));
+ Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
+ Clause : Node_Id;
+ Withn : Node_Id;
begin
Clause := U.First_Implicit_With;
@@ -1262,11 +1263,18 @@ package body Rtsfind is
Clause := Next_Implicit_With (Clause);
end loop;
+ -- We want to make sure that the "with" we create below isn't
+ -- marked as ignored ghost code because this list may be walked
+ -- later, after ignored ghost code is converted to a null
+ -- statement.
+
+ Ghost_Mode := None;
Withn :=
Make_With_Clause (Standard_Location,
Name =>
Make_Unit_Name
(U, Defining_Unit_Name (Specification (LibUnit))));
+ Ghost_Mode := Saved_GM;
Set_Corresponding_Spec (Withn, U.Entity);
Set_First_Name (Withn);