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

[Bug]: Fix BodyInterceptor: Dead Assignment Eliminator #1034

Closed
sahilagichani14 opened this issue Aug 21, 2024 · 1 comment · Fixed by #1070
Closed

[Bug]: Fix BodyInterceptor: Dead Assignment Eliminator #1034

sahilagichani14 opened this issue Aug 21, 2024 · 1 comment · Fixed by #1070
Assignees
Labels
bug Something isn't working

Comments

@sahilagichani14
Copy link
Collaborator

sahilagichani14 commented Aug 21, 2024

What happened?

doesn't remove the dead assignments. For example: x = 10; is a dead assignment, as well as x = 20; since they are reassigned to new values or not used after that statement.
int tc6_1(int temp) { int x = 10; x = 30; temp = x; if (temp > 5) { x = someMethod(); } x = 20; return temp; }

current Output:
'this := @this: sootUp.RQ1.jb_dae.JB_DAE;
temp := @parameter0: int;
x = 10;
x = 30;
temp = x;

if temp <= 5 goto label1;
x = virtualinvoke this.<sootUp.RQ1.jb_dae.JB_DAE: int someMethod()>();

label1:
x = 20;

return temp;'

Expected Output:
`this := @this: sootUp.RQ1.jb_dae.JB_DAE;
temp := @parameter0: int;
x = 30;
temp = x;

if temp <= 5 goto label1;
x = virtualinvoke this.<sootUp.RQ1.jb_dae.JB_DAE: int someMethod()>();

label1:
return temp;`

Version

Latest develop branch

Relevant log output

No response

@sahilagichani14 sahilagichani14 added the bug Something isn't working label Aug 21, 2024
@sahilagichani14 sahilagichani14 self-assigned this Aug 21, 2024
@sahilagichani14
Copy link
Collaborator Author

sahilagichani14 commented Aug 21, 2024

ToDo's:

  • add documentation
  • add test cases
  • Are there any statements that don't have stmtPositionInfo? - from the API: nope, reality: usually stack assignments don't get them assigned, or in general, if no debug info is available

@sahilagichani14 sahilagichani14 linked a pull request Sep 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant