From 8a08b602e30054c283adb8fc1a4077aaf99efbca Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Wed, 29 Sep 2021 15:00:38 -0700
Subject: qbe: Add missing check that binary operator is + for address constant

---
 qbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
cgit v1.2.3