From 63906cb162a5ee5c7284b4598ffb062e9a6541bb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 6 Aug 2018 07:15:27 +0200 Subject: Release secondary stack within elab_declaration_chain. Fix #616 --- src/vhdl/translate/trans-chap2.adb | 3 +++ src/vhdl/translate/trans-chap4.adb | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3