From 77476d6ecc45f1761125524cbdeddfe74e3b157a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 13 Sep 2021 21:51:43 +0200 Subject: ortho: for slices, get element size from the result type and not from the object type. Fix #1862 --- src/ortho/mcode/ortho_code-exprs.adb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/ortho/mcode') 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; -- cgit v1.2.3