aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans-chap5.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-06-12 05:37:49 +0200
committerTristan Gingold <tgingold@free.fr>2017-06-12 05:37:49 +0200
commitd986b9af22f4e927e887f1bd6f9ff5174dde4aca (patch)
tree87d270fb31ef48030983f0e89b66ea4705c8a5a4 /src/vhdl/translate/trans-chap5.adb
parent5ba7861a7d065b1feb90de890ce34e837cb12fdf (diff)
downloadghdl-d986b9af22f4e927e887f1bd6f9ff5174dde4aca.tar.gz
ghdl-d986b9af22f4e927e887f1bd6f9ff5174dde4aca.tar.bz2
ghdl-d986b9af22f4e927e887f1bd6f9ff5174dde4aca.zip
Fix crash of implicit conversion in instantiation.
Fix #301
Diffstat (limited to 'src/vhdl/translate/trans-chap5.adb')
-rw-r--r--src/vhdl/translate/trans-chap5.adb16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb
index f4efc4103..dbccd5ac4 100644
--- a/src/vhdl/translate/trans-chap5.adb
+++ b/src/vhdl/translate/trans-chap5.adb
@@ -36,12 +36,23 @@ package body Trans.Chap5 is
Scope => Scope_Ptr.all);
end Save_Map_Env;
- procedure Set_Map_Env (Env : Map_Env)
+ procedure Restore_Map_Env (Env : Map_Env)
is
-- Avoid potential compiler bug with discriminant check.
pragma Suppress (Discriminant_Check);
begin
Env.Scope_Ptr.all := Env.Scope;
+ end Restore_Map_Env;
+
+ procedure Set_Map_Env (Env : Map_Env) is
+ begin
+ -- In some cases, the previous environment is still needed (for example
+ -- an implicit array conversion accesses to both the formal and the
+ -- actual type). Set ENV only if it is not null, in order not to erase
+ -- the previous env.
+ if not Is_Null (Env.Scope) then
+ Restore_Map_Env (Env);
+ end if;
end Set_Map_Env;
procedure Translate_Attribute_Specification
@@ -742,7 +753,7 @@ package body Trans.Chap5 is
end;
Next_Association_Interface (Assoc, Inter);
end loop;
- Set_Map_Env (Actual_Env);
+ Restore_Map_Env (Actual_Env);
end Elab_Port_Map_Aspect;
procedure Elab_Generic_Map_Aspect
@@ -855,6 +866,7 @@ package body Trans.Chap5 is
Close_Temp;
Next_Association_Interface (Assoc, Inter);
end loop;
+ Restore_Map_Env (Actual_Env);
end Elab_Generic_Map_Aspect;
procedure Elab_Map_Aspect