From e1d0927744cb86ae3636dedc8473c405a0870ac4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 5 Sep 2024 12:44:01 -0400 Subject: Fix 'empty' clause for integer iteration --- compile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile.c b/compile.c index f5a27ae9..c61caf60 100644 --- a/compile.c +++ b/compile.c @@ -1094,7 +1094,7 @@ CORD compile_statement(env_t *env, ast_t *ast) goto big_n; - if (for_->empty && mpz_cmp_si(i, 0) == 0) { + if (for_->empty && mpz_cmp_si(i, 0) <= 0) { return compile_statement(env, for_->empty); } else { return CORD_all( @@ -1114,7 +1114,7 @@ CORD compile_statement(env_t *env, ast_t *ast) return CORD_all( "{\n" "Int_t ", n_var, " = ", compile(env, for_->iter), ";\n" - "if (!I_is_zero(", n_var, ")) {\n" + "if (Int$compare_value(", n_var, ", I(0)) > 0) {\n" "for (Int_t ", i, " = I(1); Int$compare_value(", i, ", ", n_var, ") <= 0; ", i, " = Int$plus(", i, ", I(1))) {\n", "\t", naked_body, "}\n" -- cgit v1.2.3