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

incomplete control flow recovery #1343

Open
yangzao opened this issue Apr 29, 2024 · 0 comments
Open

incomplete control flow recovery #1343

yangzao opened this issue Apr 29, 2024 · 0 comments

Comments

@yangzao
Copy link

yangzao commented Apr 29, 2024

Description:
When decompiling a program, Reko (0.11.6.0) doesn't recover the complete control flow.
In the original code, the case 2 body is executed and "another local string" is eventually assigned to str.
But in the decompiled code, case 2 body is not shown, and "local string" is assigned to str instead.

Original code:

switch(i_l){ // i_l equals to 2
        case 0:
            i_l = 15;
            break;
        case 1:
            s_l = 456;
            break;
        case 2:
            str_l = str_l_alt; // "another local string"
            break;
        default:
            l_l = 9876543;
            break;
        }
    }
...
str = str_l;

Decompiled code:

if (rdx_36 <= 0x02)  // corresponds to i_l
	{
		switch (rdx_36)
		{
		case 0x00:
			wLoc0A_110 = 0x01C8;
			break;
		}
	}
	else
		qwLoc20_111 = 0x0096B43F;
...
		
str = (char *) "local string";

Files:
reko.zip
The original code, compiled program and the decompiled code are included.
The program is compiled by clang-12.
Unfortunately I don't have the optimization options used to compile the program,
but if you run it, it'll print out the string assigned to str ("another local string"),
which is not presented in the decompiled code.

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