From 9a2976669a85d9519f38092860ad11662834807f Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 20 Jun 2017 05:42:44 +0200 Subject: Avoid a crash while slicing array of length 0. Fix #372 --- src/ortho/mcode/ortho_code-exprs.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ortho/mcode/ortho_code-exprs.adb') diff --git a/src/ortho/mcode/ortho_code-exprs.adb b/src/ortho/mcode/ortho_code-exprs.adb index a529034ca..47064e76e 100644 --- a/src/ortho/mcode/ortho_code-exprs.adb +++ b/src/ortho/mcode/ortho_code-exprs.adb @@ -909,7 +909,7 @@ package body Ortho_Code.Exprs is -- FIXME: may recycle previous index? Sz := New_Const_U32 (Get_Expr_Low (Index) * El_Size, In_Type); else - if Is_Pow2 (El_Size) then + if Is_Pow2 (El_Size) and then El_Size /= 0 then Sz := New_Const_U32 (Extract_Pow2 (El_Size), In_Type); Sz := New_Enode (OE_Shl, In_Type, Index, Sz); else -- cgit v1.2.3