From bb3a22a3eb6b0b2be52620577c1ef5465d3bcd76 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 19 May 2019 01:06:03 -0700 Subject: decl: Allow zero length arrays gcc allows this, and glibc uses it in some headers instead of flexible array members. --- decl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decl.c b/decl.c index 81130f3..60cb89c 100644 --- a/decl.c +++ b/decl.c @@ -552,8 +552,8 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "VLAs are not yet supported"); i = e->constant.i; - if (i == 0 || e->type->basic.issigned && i > INT64_MAX) - error(&tok.loc, "array length must be positive"); + if (e->type->basic.issigned && i > INT64_MAX) + error(&tok.loc, "array length must be non-negative"); delexpr(e); expect(TRBRACK, "after array length"); } -- cgit v1.2.3