aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-06-20 05:42:44 +0200
committerTristan Gingold <tgingold@free.fr>2017-06-20 05:42:44 +0200
commit9a2976669a85d9519f38092860ad11662834807f (patch)
tree429abe6e1a2853d1c1e3317deb53d4460405bcde /src/ortho
parent5338523d5109fbb29d74da91241f1a9f2f8dc653 (diff)
downloadghdl-9a2976669a85d9519f38092860ad11662834807f.tar.gz
ghdl-9a2976669a85d9519f38092860ad11662834807f.tar.bz2
ghdl-9a2976669a85d9519f38092860ad11662834807f.zip
Avoid a crash while slicing array of length 0.
Fix #372
Diffstat (limited to 'src/ortho')
-rw-r--r--src/ortho/mcode/ortho_code-exprs.adb2
1 files changed, 1 insertions, 1 deletions
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