From 913aa8523ee7f299a6906f1b62993e304157c1e4 Mon Sep 17 00:00:00 2001 From: cannoli-fruit Date: Fri, 31 Jul 2026 01:27:10 -0400 Subject: [PATCH] Fix integer comparisons --- flagpole/src/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flagpole/src/main.c b/flagpole/src/main.c index 9ab525a..816dfb7 100644 --- a/flagpole/src/main.c +++ b/flagpole/src/main.c @@ -405,14 +405,14 @@ codegenIR: break; } if (SBeq(&tokenAccumulator, "if")) { - lz_da_append(labelStack, counter); - commentStack(&labelStack); break; } if (SBeq(&tokenAccumulator, "then")) { IRComplete(&irStatements, &irVStack); - vstackUnderflows = 0; + + lz_da_append(labelStack, counter); commentStack(&labelStack); + vstackUnderflows = 0; int lbl = lz_da_pop(labelStack); lz_da_append(labelStack, lbl); printf(" popstack 123\n"); @@ -452,7 +452,7 @@ codegenIR: } else if (irVStack.cnt == 0) { x1 = (IRValue) { .typ = IRVAL_STACK, - .val = 1 + .val = ++vstackUnderflows }; } IRValue dstReg = (IRValue) { @@ -716,7 +716,7 @@ codegenIR: }; IRStatement s = (IRStatement) { .dst = dstReg, - .op = IR_ILT, + .op = IR_IGT, .arg1 = x1, .arg2 = x2 }; @@ -732,7 +732,7 @@ codegenIR: }; IRStatement s = (IRStatement) { .dst = dstReg, - .op = IR_IGT, + .op = IR_ILT, .arg1 = x1, .arg2 = x2 };