Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Samuel-Oglegba opened this issue May 17, 2024 · 1 comment

Comments

@Samuel-Oglegba
Copy link
Collaborator

Samuel-Oglegba commented May 17, 2024

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
Copy link
Owner

qingyi-yan commented May 18, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants