shithub: mc

Download patch

ref: 118c93adea60980900d8976944f2eb05496783d2
parent: d22285a6aba8f6a5eba9da13fb712561e101100b
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Jul 31 05:43:08 EDT 2017

Handle empty array sizes correctly.

	The size parameter *may* be null.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2032,7 +2032,7 @@
 		if (t->type == Tyarray) {
 			typesub(t->asize, noerr);
 			t->asize = fold(t->asize, 1);
-			if (exprop(t->asize) != Olit)
+			if (t->asize && exprop(t->asize) != Olit)
 				fatal(t->asize, "nonconstant array size near %s\n", ctxstr(t->asize));
 		} else if (t->type == Tystruct) {
 			inaggr++;