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

Wrong IR for two ternary operators #219

Open
IlyaMuravjov opened this issue Feb 16, 2024 · 0 comments · Fixed by #220
Open

Wrong IR for two ternary operators #219

IlyaMuravjov opened this issue Feb 16, 2024 · 0 comments · Fixed by #220

Comments

@IlyaMuravjov
Copy link

For the following method:

public int f() {
    int i = Integer.parseInt("1"); // line 5
    boolean b = Boolean.parseBoolean("true"); // line 6
    return (b ? i : 0) + (!b ? i : 0); // line 7
}

The following rawInstList is generated.

label #0:
line number 5:
i = java.lang.Integer.parseInt("1")
label #1:
line number 6:
b = java.lang.Boolean.parseBoolean("true")
label #2:
line number 7:
if (b == false) goto #5 else #4
label #5:
goto #3
label #4:
goto #6
label #3:
i = 0
goto #6
label #6:
if (b != 0) goto #9 else #8
label #9:
goto #7
label #8:
goto #10
label #7:
i = 0
goto #10
label #10:
%10 = i + i
return %10
label #11:

According to the rawInstList the code returns 0, while executing the code without JacoDB returns 1.

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

Successfully merging a pull request may close this issue.

1 participant