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

Multiple issues in fbranch #1117

Open
rfalke opened this issue Dec 28, 2021 · 2 comments
Open

Multiple issues in fbranch #1117

rfalke opened this issue Dec 28, 2021 · 2 comments
Assignees
Labels
bug This issue describes a defect in Reko local-stack-variables This issue is about incorrect propagation/elimination of local stack variables

Comments

@rfalke
Copy link

rfalke commented Dec 28, 2021

Subject: https://github.com/rfalke/decompiler-subjects/blob/master/from_boomerang/fbranch/arm64_elf_clang_O0_from_rfalke/by_reko.c

Output:

void main()
{
	x0_17 = (uint64) __isoc99_scanf("%f", fp - 0x14);
	x0_32 = (uint64) printf("a is %f, b is %f\n", (real64) 7e-45F, (real64) dwLoc14);
	struct Eq_125 * sp_107 = fp - 0x48;
	if (dwLoc14 == 5.0F)
	{
		x0_42 = (uint64) printf("Equal\n");
		sp_107 = fp - 0x50;
	}

Issues:

  • fp - 0x14 should be & dwLoc14
  • 7e-45F should be 5.0f
  • The return values of __isoc99_scanf and printf are unused, no extra variables needed
@uxmal uxmal self-assigned this Jan 7, 2022
@uxmal uxmal added the bug This issue describes a defect in Reko label Jan 7, 2022
@uxmal
Copy link
Owner

uxmal commented Jan 7, 2022

The (non-)conversion fp - 0x14 to &dwLoc14 is a known issue, and is being investigated as part of the implementation of proper escape analysis (@ptomin and I are in discussions)

  • Incorrect conversion of floating point constant (cause found, but preliminary fix causes massive regressions)
  • dead return values should be removed.

@ptomin ptomin added the local-stack-variables This issue is about incorrect propagation/elimination of local stack variables label Jan 8, 2022
@rfalke
Copy link
Author

rfalke commented Aug 26, 2023

Output of version 0.11.4.0-931ca7d:

void main(Eq_91 s0)
{
	ptr64 fp;
	Eq_91 dwLoc1C;
	__isoc99_scanf("%f", fp + ~0x1B);
	printf("a is %f, b is %f\n", (real64) s0, (real64) dwLoc1C);
	if (s0 == dwLoc1C)
		printf("Equal\n");
...}

Issues:

  • fp + ~0x1B should be & dwLoc1C
  • s0 is not a parameter of main() but contains the constant of 5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a defect in Reko local-stack-variables This issue is about incorrect propagation/elimination of local stack variables
Projects
None yet
Development

No branches or pull requests

3 participants