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

[Hungarian Notation] Variables with different names but same labels are renamed to the same variable. #309

Open
mari-mari opened this issue Aug 9, 2023 · 3 comments · May be fixed by #317
Assignees
Labels
blocked Is blocked by another issue bug Something isn't working priority-high High priority issue

Comments

@mari-mari
Copy link
Collaborator

mari-mari commented Aug 9, 2023

What happened?

Variables with different names but same labels are renamed to the same variable.

Consider the following test, that currently fails:

    def test_same_variable_idx():
    """Variables can be copies of the same one. The renamer should only rename a variable once. (More times would destroy   the actual name)"""
        true_value = LogicCondition.initialize_true(LogicCondition.generate_new_context())
        var1 = Variable("x_1", Integer.int32_t())
        var2 = Variable("y_1", Integer.int32_t())
        ast = AbstractSyntaxTree(CodeNode([
            Assignment(var1, Constant(0)),
            Assignment(var2, Constant(0))], true_value), {})
        _run_vng(ast, _generate_options())
        assert var1._name != var2._name

In this case different variables (x_1 and y_1) should become different names, despite having same label. However, they both of them are named var_1.

How to reproduce?

Add the test above and run it. The test fails currently.

Affected Binary Ninja Version(s)

3.4.4271

@mari-mari mari-mari added bug Something isn't working priority-high High priority issue labels Aug 9, 2023
@NeoQuix NeoQuix self-assigned this Aug 10, 2023
@NeoQuix
Copy link
Collaborator

NeoQuix commented Aug 15, 2023

Will use this issue as the Part02 of the renaming refactor (Fix variable-name-generation).
Part01 (#316) should be merged before this request.

@NeoQuix
Copy link
Collaborator

NeoQuix commented Aug 15, 2023

/cib

@github-actions
Copy link
Contributor

github-actions bot pushed a commit that referenced this issue Aug 15, 2023
@NeoQuix NeoQuix added the blocked Is blocked by another issue label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Is blocked by another issue bug Something isn't working priority-high High priority issue
Projects
None yet
2 participants