From 61367525aea8f3f11c29e628fe49768dda959cef Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 19 Jun 2023 22:33:35 +0200 Subject: backend: compile comparison instrs and branches --- c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'c.c') diff --git a/c.c b/c.c index ec3d133..6db23be 100644 --- a/c.c +++ b/c.c @@ -1513,7 +1513,7 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard) Cmp: ty = cvtarith(sub[0].ty, sub[1].ty); if (!ty.t) ty.t = TYPTR; - if (isunsigned(ty) && in_range(ins.op, Olth, Olte)) + if (isunsigned(ty) && in_range(ins.op, Olth, Ogte)) ins.op += Oulth - Olth; ins.l = compileexpr(fn, &sub[0], discard); ins.r = compileexpr(fn, &sub[1], discard); @@ -1928,7 +1928,8 @@ localdecl(struct comp *cm, struct function *fn, bool forini) } Err: if (!put) putdecl(cm, &decl); - } + } else if (forini) + error(&decl.span, "non-variable declaration in 'for' loop initializer"); } while (st.more); } -- cgit v1.2.3