aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/cgen.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-06 16:11:26 +0200
committerlemon <lsof@mailbox.org>2022-08-06 16:11:26 +0200
commit0c6330ce7ee50c1fa241793588fa83a3c00bc3c1 (patch)
tree3c8c42804a8056a61b267d690a13688d6580630a /bootstrap/cgen.c
parentc53e17496d97a2fb638544cee414de97d81770fc (diff)
inferred length array init
Diffstat (limited to 'bootstrap/cgen.c')
-rw-r--r--bootstrap/cgen.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c
index 9fa954c..8a01e09 100644
--- a/bootstrap/cgen.c
+++ b/bootstrap/cgen.c
@@ -554,10 +554,11 @@ defctype(const struct type *ty, void *_) {
defctype(ty->child, NULL);
break;
case TYarr:
- assert(ty->length >= 0);
- defctype(ty->child, NULL);
- *cname = xasprintf("__ty%d", id++);
- pri("typedef %t %s[%U];\n", ty->child, *cname, ty->length);
+ if (ty->length >= 0) {
+ defctype(ty->child, NULL);
+ *cname = xasprintf("__ty%d", id++);
+ pri("typedef %t %s[%U];\n", ty->child, *cname, ty->length);
+ }
break;
case TYslice:
defctype(ty->child, NULL);