From 224eb809a03920342d39853fdb09a3aa3724d110 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Fri, 16 Jun 2023 15:19:43 +0800 Subject: [PATCH] fix: 3ac code for loop --- core/scf_operator_handler_3ac.c | 4 ++++ core/scf_variable.h | 1 + parse/scf_operator_handler_semantic.c | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/scf_operator_handler_3ac.c b/core/scf_operator_handler_3ac.c index 034b105..d2fbc70 100644 --- a/core/scf_operator_handler_3ac.c +++ b/core/scf_operator_handler_3ac.c @@ -1008,14 +1008,18 @@ static int _scf_op_end_loop(scf_list_t* start_prev, scf_list_t* continue_prev, s break; case SCF_OP_3AC_JGT: jmp_op = SCF_OP_3AC_JLE; + break; case SCF_OP_3AC_JA: jmp_op = SCF_OP_3AC_JBE; + break; case SCF_OP_3AC_JAE: jmp_op = SCF_OP_3AC_JB; + break; case SCF_OP_3AC_JB: jmp_op = SCF_OP_3AC_JAE; + break; case SCF_OP_3AC_JBE: jmp_op = SCF_OP_3AC_JA; break; diff --git a/core/scf_variable.h b/core/scf_variable.h index cbb09f3..934595a 100644 --- a/core/scf_variable.h +++ b/core/scf_variable.h @@ -58,6 +58,7 @@ struct scf_variable_s { uint32_t arg_flag :1; uint32_t auto_gc_flag:1; + uint32_t array_flag :1; uint32_t input_flag :1; uint32_t output_flag :1; }; diff --git a/parse/scf_operator_handler_semantic.c b/parse/scf_operator_handler_semantic.c index 9635177..148b7a4 100644 --- a/parse/scf_operator_handler_semantic.c +++ b/parse/scf_operator_handler_semantic.c @@ -966,8 +966,8 @@ static int _scf_op_semantic_array_index(scf_ast_t* ast, scf_node_t** nodes, int } else if (0 == v0->nb_dimentions && v0->nb_pointers > 0) { nb_pointers = v0->nb_pointers - 1; } else { - scf_loge("index out, v0: %s, v0->nb_dimentions: %d, v0->nb_pointers: %d\n", - v0->w->text->data, v0->nb_dimentions, v0->nb_pointers); + scf_loge("index out, v0: %s, v0->nb_dimentions: %d, v0->nb_pointers: %d, v0->arg_flag: %d, v0->output_flag: %d\n", + v0->w->text->data, v0->nb_dimentions, v0->nb_pointers, v0->arg_flag, v0->output_flag); return -1; } -- 2.25.1