aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-07-27 18:54:12 +0200
committerTristan Gingold <tgingold@free.fr>2020-07-27 18:54:12 +0200
commit89f81ef02c4fb9d0441a2b1c773c8e9da79cda5a (patch)
tree196ca66b632387d7c3b4484086c87f983ce18fd2 /src
parenta663cbbe964e351e91560d0c7e660f90deb3f83e (diff)
downloadghdl-89f81ef02c4fb9d0441a2b1c773c8e9da79cda5a.tar.gz
ghdl-89f81ef02c4fb9d0441a2b1c773c8e9da79cda5a.tar.bz2
ghdl-89f81ef02c4fb9d0441a2b1c773c8e9da79cda5a.zip
translate: fix foreach_non_composite for arrays with unbounded elements.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/translate/trans-chap3.adb9
-rw-r--r--src/vhdl/translate/trans-chap3.ads2
-rw-r--r--src/vhdl/translate/trans-helpers2.adb6
3 files changed, 11 insertions, 6 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index b88881ed3..861ba894a 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -2726,11 +2726,11 @@ package body Trans.Chap3 is
return Layout_To_Bounds (Array_Bounds_To_Element_Layout (B, Arr_Type));
end Array_Bounds_To_Element_Bounds;
- function Array_Bounds_To_Element_Size (B : Mnode; Arr_Type : Iir)
- return O_Lnode is
+ function Array_Bounds_To_Element_Size
+ (B : Mnode; Arr_Type : Iir; Mode : Object_Kind_Type) return O_Lnode is
begin
return Layout_To_Size
- (Array_Bounds_To_Element_Layout (B, Arr_Type), Get_Object_Kind (B));
+ (Array_Bounds_To_Element_Layout (B, Arr_Type), Mode);
end Array_Bounds_To_Element_Size;
function Type_To_Range (Atype : Iir) return Mnode
@@ -3039,7 +3039,8 @@ package body Trans.Chap3 is
(ON_Mul_Ov,
Index,
New_Value (Array_Bounds_To_Element_Size
- (Get_Composite_Bounds (Arr), Atype))),
+ (Get_Composite_Bounds (Arr), Atype,
+ Get_Object_Kind (Arr)))),
El_Tinfo.B.Base_Ptr_Type (Kind)),
El_Tinfo, Kind,
El_Tinfo.B.Base_Type (Kind),
diff --git a/src/vhdl/translate/trans-chap3.ads b/src/vhdl/translate/trans-chap3.ads
index bf524d43c..e9375fcf8 100644
--- a/src/vhdl/translate/trans-chap3.ads
+++ b/src/vhdl/translate/trans-chap3.ads
@@ -131,6 +131,8 @@ package Trans.Chap3 is
-- set the bounds of it (from ARR), and return it.
-- Otherwise, return a null mnode.
-- Used to build a var for a subelement of ARR.
+ -- This is used by foreach_non_composite to factorize fat-pointer
+ -- building.
function Create_Maybe_Fat_Array_Element (Arr : Mnode; Arr_Type : Iir)
return Mnode;
diff --git a/src/vhdl/translate/trans-helpers2.adb b/src/vhdl/translate/trans-helpers2.adb
index a773fa7aa..dfaa1c8d6 100644
--- a/src/vhdl/translate/trans-helpers2.adb
+++ b/src/vhdl/translate/trans-helpers2.adb
@@ -234,7 +234,8 @@ package body Trans.Helpers2 is
Res := E2M (Val, Type_Info, Mode_Value);
case Type_Info.Type_Mode is
when Type_Mode_Arrays =>
- Res := Chap3.Get_Composite_Base (Res);
+ null;
+ -- Res := Chap3.Get_Composite_Base (Res);
-- Res := Chap3.Convert_Array_Base (Res);
when Type_Mode_Records =>
Res := Stabilize (Res);
@@ -250,7 +251,8 @@ package body Trans.Helpers2 is
Index : O_Dnode)
return O_Enode is
begin
- return M2E (Chap3.Index_Base (Val, Targ_Type, New_Obj_Value (Index)));
+ return M2E (Chap6.Translate_Indexed_Name_By_Offset
+ (Val, Targ_Type, Index));
end Gen_Oenode_Update_Data_Array;
function Gen_Oenode_Update_Data_Record