commit b1ba24556d4d0127ac0e7473fe9232c7ea5531e5
parent 283ecfcc4c23b0196e824239c103fae99b67ef29
Author: m21c <ho*******@gmail.com>
Date: Tue, 1 Feb 2022 21:33:59 +0100
fix: array size may be empty (maybe will change in the future)
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/compiler.c b/compiler.c
@@ -4047,7 +4047,11 @@ printtypetail(FILE *out, Type *type, int indent)
switch (type->kind) {
case TARRAY:
n += fprintf(out, "[");
- n += printexpr(out, type->u.val, indent);
+
+ /* NOTE(m21c): the value may be always set in the future */
+ if (type->u.val)
+ n += printexpr(out, type->u.val, indent);
+
n += fprintf(out, "]");
break;