aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-29 15:00:38 -0700
committerMichael Forney <mforney@mforney.org>2021-09-29 15:04:44 -0700
commit8a08b602e30054c283adb8fc1a4077aaf99efbca (patch)
tree87cbc9de2e91aa89b6894e46455f992fd491942d
parentcb697da1d5c36ac4e75e554cbc279674dd7075f4 (diff)
qbe: Add missing check that binary operator is + for address constant
-rw-r--r--qbe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qbe.c b/qbe.c
index d3b1605..726d3b3 100644
--- a/qbe.c
+++ b/qbe.c
@@ -1311,7 +1311,7 @@ dataitem(struct expr *expr, uint64_t size)
emitvalue(decl->value);
break;
case EXPRBINARY:
- if (expr->binary.l->kind != EXPRUNARY || expr->binary.r->kind != EXPRCONST)
+ if (expr->op != TADD || expr->binary.l->kind != EXPRUNARY || expr->binary.r->kind != EXPRCONST)
error(&tok.loc, "initializer is not a constant expression");
dataitem(expr->binary.l, 0);
fputs(" + ", stdout);