summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold2015-01-30 02:25:42 +0100
committerTristan Gingold2015-01-30 02:25:42 +0100
commit4f152b890fe63789857ba9d6f5b9629eb46ab418 (patch)
treecd7b6f8719b2570b3f0e33b33cdd742b8e9d6e6a /src
parentb4ab1d98836f90aece21e8ad600669e524c2a898 (diff)
downloadghdl-4f152b890fe63789857ba9d6f5b9629eb46ab418.tar.gz
ghdl-4f152b890fe63789857ba9d6f5b9629eb46ab418.tar.bz2
ghdl-4f152b890fe63789857ba9d6f5b9629eb46ab418.zip
grt: fix protected object lock during elaboration.
Diffstat (limited to 'src')
-rw-r--r--src/grt/grt-processes.adb10
-rw-r--r--src/vhdl/errorout.adb2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/grt/grt-processes.adb b/src/grt/grt-processes.adb
index 0a905d8..4a124e6 100644
--- a/src/grt/grt-processes.adb
+++ b/src/grt/grt-processes.adb
@@ -564,14 +564,20 @@ package body Grt.Processes is
is
Lock : constant Object_Lock_Acc := To_Lock_Acc_Acc (Obj).all;
begin
- if Lock.Process = null then
- if Lock.Count /= 0 then
+ if Lock.Count = 0 then
+ -- Protected object not locked.
+ if Lock.Process /= null then
+ -- Sanity check failed: count must be 0.
Internal_Error ("protected_enter");
end if;
+
+ -- Note: during elaboration, there is no current process.
Lock.Process := Get_Current_Process;
Lock.Count := 1;
else
+ -- Protected object already locked.
if Lock.Process /= Get_Current_Process then
+ -- Should be locked by the current process.
Internal_Error ("protected_enter(2)");
end if;
Lock.Count := Lock.Count + 1;
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb
index 0923c59..877fea2 100644
--- a/src/vhdl/errorout.adb
+++ b/src/vhdl/errorout.adb
@@ -53,7 +53,7 @@ package body Errorout is
is
Str: constant String := Natural'Image (Val);
begin
- Put (Str(Str'First + 1 .. Str'Last));
+ Put (Str (Str'First + 1 .. Str'Last));
end Disp_Natural;
procedure Error_Msg (Msg: String) is