aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-10-02 08:13:37 +0200
committerTristan Gingold <tgingold@free.fr>2016-10-02 08:13:37 +0200
commit83b68f40eed8f003140be35d966bdd72ec7c4e20 (patch)
treea5c34e2808dcc87c264692043f7b1f410fe7fd2c
parent7784fd83f47763efc5126b96cebc322f3311774e (diff)
downloadghdl-83b68f40eed8f003140be35d966bdd72ec7c4e20.tar.gz
ghdl-83b68f40eed8f003140be35d966bdd72ec7c4e20.tar.bz2
ghdl-83b68f40eed8f003140be35d966bdd72ec7c4e20.zip
nodes_gc: check bad refs
-rw-r--r--src/vhdl/nodes_gc.adb20
-rw-r--r--src/vhdl/sem_names.adb1
2 files changed, 19 insertions, 2 deletions
diff --git a/src/vhdl/nodes_gc.adb b/src/vhdl/nodes_gc.adb
index 81c8eb3e3..c73331e3a 100644
--- a/src/vhdl/nodes_gc.adb
+++ b/src/vhdl/nodes_gc.adb
@@ -94,6 +94,16 @@ package body Nodes_GC is
Report_Already_Marked (N);
end Already_Marked;
+ procedure Not_Marked (N : Iir; F : Nodes_Meta.Fields_Enum)
+ is
+ use Ada.Text_IO;
+ begin
+ Put ("early reference to ");
+ Put (Nodes_Meta.Get_Field_Image (F));
+ Put (" in ");
+ Disp_Tree.Disp_Tree (N, True);
+ end Not_Marked;
+
procedure Mark_Chain (Head : Iir)
is
El : Iir;
@@ -129,8 +139,14 @@ package body Nodes_GC is
for I in Fields'Range loop
F := Fields (I);
case Get_Field_Attribute (F) is
- when Attr_Ref
- | Attr_Forward_Ref
+ when Attr_Ref =>
+ pragma Assert (Get_Field_Type (F) = Type_Iir);
+ if Is_Valid (Get_Iir (N, F))
+ and then not Markers (Get_Iir (N, F))
+ then
+ Not_Marked (N, F);
+ end if;
+ when Attr_Forward_Ref
| Attr_Chain_Next =>
null;
when Attr_Maybe_Ref =>
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 1d2865f15..22c2b06eb 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -906,6 +906,7 @@ package body Sem_Names is
return Res;
end Sem_Type_Mark;
+ -- Return Globally if the prefix of NAME is a globally static name.
function Get_Object_Type_Staticness (Name : Iir) return Iir_Staticness
is
Base : constant Iir := Get_Base_Name (Name);