diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-09-13 21:51:43 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-09-14 04:16:51 +0200 |
commit | 77476d6ecc45f1761125524cbdeddfe74e3b157a (patch) | |
tree | f6107b185b8c92f28e99d129e839a0c28fbe211e /src/ortho/mcode | |
parent | 95cbcc921d92d58dbd25d328de60c18976083d2a (diff) | |
download | ghdl-77476d6ecc45f1761125524cbdeddfe74e3b157a.tar.gz ghdl-77476d6ecc45f1761125524cbdeddfe74e3b157a.tar.bz2 ghdl-77476d6ecc45f1761125524cbdeddfe74e3b157a.zip |
ortho: for slices, get element size from the result type
and not from the object type.
Fix #1862
Diffstat (limited to 'src/ortho/mcode')
-rw-r--r-- | src/ortho/mcode/ortho_code-exprs.adb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ortho/mcode/ortho_code-exprs.adb b/src/ortho/mcode/ortho_code-exprs.adb index cb913a49d..b8cd698e8 100644 --- a/src/ortho/mcode/ortho_code-exprs.adb +++ b/src/ortho/mcode/ortho_code-exprs.adb @@ -893,15 +893,13 @@ package body Ortho_Code.Exprs is end Extract_Pow2; function New_Index_Slice_Element - (Arr : O_Lnode; Index : O_Enode; Res_Type : O_Tnode) + (Arr : O_Lnode; Index : O_Enode; Res_Type : O_Tnode; El_Type : O_Tnode) return O_Lnode is - El_Type : O_Tnode; In_Type : O_Tnode; Sz : O_Enode; El_Size : Uns32; begin - El_Type := Get_Type_Array_Element (Get_Enode_Type (O_Enode (Arr))); In_Type := Get_Enode_Type (Index); if Flag_Debug_Assert then @@ -953,7 +951,7 @@ package body Ortho_Code.Exprs is if Flag_Debug_Hli then return New_Hli_Index_Slice (OE_Index_Ref, El_Type, Arr, Index); else - return New_Index_Slice_Element (Arr, Index, El_Type); + return New_Index_Slice_Element (Arr, Index, El_Type, El_Type); end if; end New_Indexed_Element; @@ -969,7 +967,8 @@ package body Ortho_Code.Exprs is if Flag_Debug_Hli then return New_Hli_Index_Slice (OE_Slice_Ref, Res_Type, Arr, Index); else - return New_Index_Slice_Element (Arr, Index, Res_Type); + return New_Index_Slice_Element + (Arr, Index, Res_Type, Get_Type_Array_Element (Res_Type)); end if; end New_Slice; |