@@ -2670,6 +2670,9 @@ package body Tree_Walk is
2670
2670
Decl : constant Irep := New_Irep (I_Code_Decl);
2671
2671
Init_Expr : Irep := Ireps.Empty;
2672
2672
2673
+ Obj_Id : constant Symbol_Id := Intern (Unique_Name (Defined));
2674
+ Obj_Type : constant Irep := Get_Type (Id);
2675
+
2673
2676
function Has_Defaulted_Components (E : Entity_Id) return Boolean;
2674
2677
function Needs_Default_Initialisation (E : Entity_Id) return Boolean;
2675
2678
function Disc_Expr (N : Node_Id) return Node_Id;
@@ -2923,9 +2926,6 @@ package body Tree_Walk is
2923
2926
end Make_Default_Initialiser ;
2924
2927
2925
2928
-- Begin processing for Do_Object_Declaration_Full_Declaration
2926
-
2927
- Is_In_Symtab : constant Boolean :=
2928
- Global_Symbol_Table.Contains (Intern (Get_Identifier (Id)));
2929
2929
begin
2930
2930
Set_Source_Location (Decl, (Sloc (N)));
2931
2931
Set_Symbol (Decl, Id);
@@ -2946,14 +2946,22 @@ package body Tree_Walk is
2946
2946
end ;
2947
2947
end if ;
2948
2948
2949
+ if not Global_Symbol_Table.Contains (Obj_Id)
2950
+ then
2951
+ New_Object_Symbol_Entry (Object_Name => Obj_Id,
2952
+ Object_Type => Obj_Type,
2953
+ Object_Init_Value => Init_Expr,
2954
+ A_Symbol_Table => Global_Symbol_Table);
2955
+ end if ;
2956
+
2949
2957
if Init_Expr /= Ireps.Empty then
2950
2958
Append_Op (Block, Make_Code_Assign (Lhs => Id,
2951
2959
Rhs => Typecast_If_Necessary (Init_Expr, Get_Type (Id),
2952
2960
Global_Symbol_Table),
2953
2961
Source_Location => Sloc (N)));
2954
2962
end if ;
2955
2963
2956
- if not Is_In_Symtab then
2964
+ if not Global_Symbol_Table.Contains (Intern (Get_Identifier (Id))) then
2957
2965
Register_Identifier_In_Symbol_Table
2958
2966
(Id, Init_Expr, Global_Symbol_Table);
2959
2967
end if ;
0 commit comments