fix: 3ac code for loop
authoryu.dongliang <18588496441@163.com>
Fri, 16 Jun 2023 07:19:43 +0000 (15:19 +0800)
committeryu.dongliang <18588496441@163.com>
Fri, 16 Jun 2023 07:19:43 +0000 (15:19 +0800)
core/scf_operator_handler_3ac.c
core/scf_variable.h
parse/scf_operator_handler_semantic.c

index 034b10540e34b8c609add3d2b12afb7c31ae19b7..d2fbc709da40baaf8a05dcc6e206c25da0f878a8 100644 (file)
@@ -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;
index cbb09f3a6cf0bd5f5e546053c146c9c56252d4d9..934595aacba7669d07180fcde003f016dbb18ecb 100644 (file)
@@ -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;
 };
index 96351776d724948d6a48c9db2e429fb54921cb99..148b7a482dbed1b667ccac3ccf610a1973da4576 100644 (file)
@@ -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;
        }