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

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


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

--- Comment #3 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
and here is the patch:

diff --git a/src/mtype.c b/src/mtype.c
index e15206d..4cbff57 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 (mulu(tbn->size(loc), d2, overflow) == 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