diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-11-27 21:09:18 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-11-27 21:09:18 +0100 |
commit | 93e1e6fa9bd08d36307bd4767e94203ca123fbd5 (patch) | |
tree | e531662781e88c25347bc8653de19e72c3d79009 | |
parent | 5e4967dda119ded532aca66be33cf5f8977d43b5 (diff) | |
download | ghdl-93e1e6fa9bd08d36307bd4767e94203ca123fbd5.tar.gz ghdl-93e1e6fa9bd08d36307bd4767e94203ca123fbd5.tar.bz2 ghdl-93e1e6fa9bd08d36307bd4767e94203ca123fbd5.zip |
trans-chap3: unbox recod in Get_Composite_Base.
Fix #467
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 7 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 2 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap6.adb | 11 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index cd350565f..aa2c6ba1d 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -164,7 +164,7 @@ package body Trans.Chap3 is -- Note: a fat array can only be at the top of a complex type; -- the bounds must have been set. New_Association - (Assoc, M2Addr (Chap3.Unbox_Record (Chap3.Get_Composite_Base (Var)))); + (Assoc, M2Addr (Chap3.Get_Composite_Base (Var))); if Binfo.Type_Mode in Type_Mode_Unbounded then New_Association (Assoc, M2Addr (Chap3.Get_Composite_Bounds (Var))); @@ -2744,9 +2744,10 @@ package body Trans.Chap3 is Info, Kind, Info.B.Base_Type (Kind), Info.B.Base_Ptr_Type (Kind)); end; - when Type_Mode_Array - | Type_Mode_Record => + when Type_Mode_Array => return Arr; + when Type_Mode_Record => + return Unbox_Record (Arr); when others => raise Internal_Error; end case; diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index e989b8075..d02d60528 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -420,7 +420,7 @@ package body Trans.Chap5 is Chap6.Translate_Signal_Name (Formal, Formal_Sig, Formal_Val); -- Copy pointer to the values. - if Get_Info (Formal_Type).Type_Mode in Type_Mode_Arrays then + if Get_Info (Formal_Type).Type_Mode in Type_Mode_Composite then New_Assign_Stmt (M2Lp (Chap3.Get_Composite_Base (Formal_Val)), M2Addr (Chap3.Get_Composite_Base (Actual_Val))); diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index 5537890c9..5022d2a64 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -851,7 +851,14 @@ package body Trans.Chap6 is Stable_Prefix := Prefix; end if; - Base := Chap3.Get_Composite_Base (Stable_Prefix); + if Get_Type_Info (Stable_Prefix).Type_Mode = Type_Mode_Unbounded_Record + then + -- Get the base. + Base := Chap3.Get_Composite_Base (Stable_Prefix); + else + -- Might be a boxed subtype; keep the box to optimize the access. + Base := Stable_Prefix; + end if; Base_Tinfo := Get_Type_Info (Base); Box_Field := Base_Tinfo.S.Box_Field (Kind); @@ -879,7 +886,7 @@ package body Trans.Chap6 is Chararray_Type, New_Value (New_Selected_Element (B, - El_Info.Field_Node (Kind)))), + El_Info.Field_Node (Kind)))), El_Tinfo.B.Base_Ptr_Type (Kind)), El_Tinfo, Kind); else |