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 translation of x++ operator #46

Open
yucer opened this issue Sep 27, 2016 · 0 comments
Open

wrong translation of x++ operator #46

yucer opened this issue Sep 27, 2016 · 0 comments

Comments

@yucer
Copy link

yucer commented Sep 27, 2016

Here is another one. I don't know if this comes from ANTLR, or is something that could be solved here.

The Java code:

if (condition):
    myArr[count++] = index;
    # .. more code here
    myArr[count++] = index;

is translated to:

__count_1 = count
count += 1
__count_2 = count
count += 1
if condition:
    myArr[__count_1] = index;
    # .. more code here
    myArr[__count_2] = index;

It should be translated to:

if condition:
    myArr[count] = index;
    count += 1
    # .. more code here
    myArr[count] = index;
    count += 1

Otherwise the result is not the same if the additional code between both assignments do change the count variable.

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

1 participant