qingyi-yan / POET

Other
1 stars 2 forks source link

LHS and RHS of CODE.Assign#(lhs,rhs) bug in collect_variable_defuse pars=(var, stmt, input) #46

Open Samuel-Oglegba opened 5 months ago

Samuel-Oglegba commented 5 months ago

In collect_variable_defuse pars=(var, stmt, input) the output is (_res_before,_res_after,_found_stmt,_stop), the case for handling CODE.Assign#(lhs, rhs) updates found_stmt with the output of the rhs and the updated value of found_stmt could affect the result lhs by changing if it is in _res_before or _res_after.

Example:

calling XFORM.collect_variable_uses(js_ctx->depth, (js_ctx->depth++), Function find_next()) to get the use of js_ctx->depth, defined in statement js_ctx->depth++.

    static struct jsontree_value * find_next(struct jsontree_context *js_ctx)
    {
    ...
          js_ctx->depth++;        /* step down to value... */
          js_ctx->index[js_ctx->depth] = 0;       /* and init index */
          js_ctx->values[js_ctx->depth] = ov;
          /* Continue on this new level */
          return ov;
    ...
    }

Output:

( NULL ) i.e. the use of js_ctx->depth not found in js_ctx->index[js_ctx->depth] and js_ctx->values[js_ctx->depth] because they will be in _res_before .

Expected Output:

( js_ctx->index[js_ctx->depth] = 0; , js_ctx->values[js_ctx->depth] = ov; )

qingyi-yan commented 5 months ago

Please try to merge your tests into the POET repo in order for me to help you fix it.

On Fri, May 17, 2024 at 2:07 PM Samuel-Oglegba @.***> wrote:

In collect_variable_defuse pars=(var, stmt, input) the output is (_res_before,_res_after,_found_stmt,_stop), the case for handling CODE.Assign#(lhs, rhs) updates found_stmt with the output of the rhs and the updated value of found_stmt could affect the result lhs by changing if it is in _res_before or _res_after. Example:

calling XFORM.collect_variable_uses(js_ctx->depth, (js_ctx->depth++), Function find_next()) to get the use of js_ctx->depth, defined in statement js_ctx->depth++.

static struct jsontree_value * find_next(struct jsontree_context *js_ctx)
{
...
      js_ctx->depth++;        /* step down to value... */
      js_ctx->index[js_ctx->depth] = 0;       /* and init index */
      js_ctx->values[js_ctx->depth] = ov;
      /* Continue on this new level */
      return ov;
...
}

Output:

( NULL ) i.e. the use of js_ctx->depth not found in js_ctx->index[js_ctx->depth] and js_ctx->values[js_ctx->depth] . Expected Output:

( js_ctx->index[js_ctx->depth] = 0; , js_ctx->values[js_ctx->depth] = ov; )

— Reply to this email directly, view it on GitHub https://github.com/qingyi-yan/POET/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4A2JSREJNH7KLRYJMTO23ZCZWQRAVCNFSM6AAAAABH4ZCYA6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMYDGNJXHA4DCMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>