aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-08-06 07:15:27 +0200
committerTristan Gingold <tgingold@free.fr>2018-08-07 06:27:16 +0200
commit63906cb162a5ee5c7284b4598ffb062e9a6541bb (patch)
tree1d780eafef297f3c665888e230b4fd84fac2c937 /src
parentfff29e971150f24456b0f0407ae0dba773d31299 (diff)
downloadghdl-63906cb162a5ee5c7284b4598ffb062e9a6541bb.tar.gz
ghdl-63906cb162a5ee5c7284b4598ffb062e9a6541bb.tar.bz2
ghdl-63906cb162a5ee5c7284b4598ffb062e9a6541bb.zip
Release secondary stack within elab_declaration_chain. Fix #616
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/translate/trans-chap2.adb3
-rw-r--r--src/vhdl/translate/trans-chap4.adb5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index fbd04d9b8..81f4fa7a3 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -656,6 +656,9 @@ package body Trans.Chap2 is
Chap4.Elab_Declaration_Chain (Subprg, Final);
+ if not Has_Suspend then
+ Stack2_Release;
+ end if;
-- If finalization is required and if the subprogram is a function,
-- create a variable for the result.
if (Final or Is_Prot) and Is_Ortho_Func then
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb
index f32ec0f91..b2011df12 100644
--- a/src/vhdl/translate/trans-chap4.adb
+++ b/src/vhdl/translate/trans-chap4.adb
@@ -2503,7 +2503,10 @@ package body Trans.Chap4 is
--when Iir_Kind_Signal_Declaration =>
-- Chap1.Elab_Signal (Decl);
when Iir_Kind_Variable_Declaration
- | Iir_Kind_Constant_Declaration =>
+ | Iir_Kind_Constant_Declaration =>
+ -- Do not call Open_Temp/Close_Temp, as objects may be created
+ -- using alloca (which has a scope life) or on the secondary
+ -- stack.
Elab_Object (Decl);
if Get_Kind (Get_Type (Decl))
= Iir_Kind_Protected_Type_Declaration