aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2014-11-15 16:50:54 +0100
committerTristan Gingold <tgingold@free.fr>2014-11-15 16:50:54 +0100
commita67dcaa2aab0ee03efec74737f2c02101eec7adc (patch)
tree1b2c7888e1776fcfde20d391df1a07fa949c6ff4 /src
parent00c3a20ef1fac97332d44e63f0e5767446e8ec98 (diff)
downloadghdl-a67dcaa2aab0ee03efec74737f2c02101eec7adc.tar.gz
ghdl-a67dcaa2aab0ee03efec74737f2c02101eec7adc.tar.bz2
ghdl-a67dcaa2aab0ee03efec74737f2c02101eec7adc.zip
translate_expression: handle implicit type for aggregate.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/translate/trans-chap7.adb16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 63c0b8e21..99a51689d 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -3411,12 +3411,16 @@ package body Trans.Chap7 is
begin
-- Extract the type of the aggregate. Use the type of the
-- context if it is fully constrained.
- pragma Assert (Rtype /= Null_Iir);
- if Is_Fully_Constrained_Type (Rtype) then
+ Aggr_Type := Expr_Type;
+ if Rtype /= Null_Iir
+ and then Is_Fully_Constrained_Type (Rtype)
+ then
Aggr_Type := Rtype;
else
- Aggr_Type := Expr_Type;
+ pragma Assert (Is_Fully_Constrained_Type (Expr_Type));
+ null;
end if;
+
if Get_Kind (Aggr_Type) = Iir_Kind_Array_Subtype_Definition
then
Chap3.Create_Array_Subtype (Aggr_Type, True);
@@ -3439,7 +3443,7 @@ package body Trans.Chap7 is
Translate_Aggregate (Mres, Aggr_Type, Expr);
Res := M2E (Mres);
- if Aggr_Type /= Rtype then
+ if Rtype /= Null_Iir and then Aggr_Type /= Rtype then
Res := Translate_Implicit_Conv
(Res, Aggr_Type, Rtype, Mode_Value, Expr);
end if;
@@ -4644,8 +4648,8 @@ package body Trans.Chap7 is
New_Assign_Stmt
(M2Lp (Chap3.Get_Array_Base (Var_Arr)),
M2Addr (Chap3.Slice_Base (Chap3.Get_Array_Base (Res),
- Arr_Type,
- New_Obj_Value (Var_L_Len))));
+ Arr_Type,
+ New_Obj_Value (Var_L_Len))));
Chap3.Translate_Object_Copy
(Var_Arr, New_Obj_Value (Var_R), Arr_Type);
Close_Temp;