aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-04-08 10:28:55 +0200
committerTristan Gingold <tgingold@free.fr>2023-04-08 10:28:55 +0200
commit8336360cbf371c70e3f9f7fd0b73dc278ffebe6d (patch)
treedd36ebae367b2ca306ef3c6732b922ef5d4d318d
parentbdc1c9cf6db576e585d60e531da14a4c8d72333d (diff)
downloadghdl-8336360cbf371c70e3f9f7fd0b73dc278ffebe6d.tar.gz
ghdl-8336360cbf371c70e3f9f7fd0b73dc278ffebe6d.tar.bz2
ghdl-8336360cbf371c70e3f9f7fd0b73dc278ffebe6d.zip
trans-chap2: defer body elaboration if non-immediate body
Fix #2402
-rw-r--r--src/vhdl/translate/trans-chap2.adb15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index 896c7b4e8..e2a2cc398 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -1687,8 +1687,6 @@ package body Trans.Chap2 is
declare
Spec_Parent : constant Iir := Get_Parent (Spec);
Bod : constant Iir := Get_Package_Body (Spec);
- Inst_Bod : constant Iir := Get_Instance_Package_Body (Inst);
- Final : Boolean;
begin
-- There are no routines generated to elaborate macro-expanded
-- packages, but dependencies still need to be elaborated.
@@ -1701,12 +1699,17 @@ package body Trans.Chap2 is
Elab_Package (Inst, Inst);
- if Inst_Bod /= Null_Iir then
+ if Get_Immediate_Body_Flag (Inst) then
-- Humm, if BOD is present then INST_BOD should also be
-- present. But this is true only if the spec needs a body.
- Open_Temp;
- Chap4.Elab_Declaration_Chain (Inst_Bod, Final);
- Close_Temp;
+ declare
+ Inst_Bod : constant Iir := Get_Instance_Package_Body (Inst);
+ Final : Boolean;
+ begin
+ Open_Temp;
+ Chap4.Elab_Declaration_Chain (Inst_Bod, Final);
+ Close_Temp;
+ end;
end if;
end;
return;