Skip to content

[PowerPC] Incorrect decompilation #7897

@wgreenberg

Description

@wgreenberg

Version and Platform (required):

  • Binary Ninja Version: 5.2.8722 (c75356aa)
  • Edition: Non-Commercial
  • OS: macOS
  • OS Version: 26.1
  • CPU Architecture: M4

Bug Description:
I was decompiling a fairly straightforward set of PowerPC instructions, but noticed that the result seemed somewhat nonsensical:

Image

This is from a program dealing with 3D graphics, so presumably the arg is a floating-point vec3, and so the result of z * (x * y * y + x) + z doesn't make much sense. Trying the same function in Ghidra, we get a much more reasonable decompilation of dist_sq:

Image

Looking up the definition of the fmadds instruction, Ghidra does appear to be correct.

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. Analyze this set of PowerPC instructions
  2. Observe the decompilation

Expected Behavior:
Decompilation resembling x * x + y * y + z * z

Metadata

Metadata

Assignees

Labels

Arch: PowerPCIssues with the PowerPC architecture pluginEffort: TrivialIssues require < 1 day of workImpact: MediumIssue is impactful with a bad, or no, workaround

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions