[Issue 14699] ICE: segfaults on array with zero size

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 14 09:11:20 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14699

--- Comment #4 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
sorry, slightly better patch:

diff --git a/src/mtype.c b/src/mtype.c
index e15206d..a464b49 100644
--- a/src/mtype.c
+++ b/src/mtype.c
@@ -4076,6 +4076,11 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)
                 error(loc, "index %llu overflow for static array", (unsigned
long long)d1);
                 goto Lerror;
             }
+            else if (d2 == 0)
+            {
+                error(loc, "index %llu underflow for static array", (unsigned
long long)d1);
+                goto Lerror;
+            }
         }
     }
     switch (tbn->ty)

--


More information about the Digitalmars-d-bugs mailing list