Skip to content

[RV32] Very bad decompilation of simple getchar function #7756

@ozoromo

Description

@ozoromo

Version and Platform (required):

  • Binary Ninja Version: 5.2.8614
  • Edition: Non-Commercial
  • OS: NixOs
  • OS Version: 25.11
  • CPU Architecture: x64

Bug Description:
I have the simple function getchar(char* c) with the following reasonably simple assembly code:

Image

That:

  • saves the incoming buffer from a0 into a5
  • sets a0 to the getchar syscall
  • returns immediately if the syscall gave a non 0 exit status
  • saves the char into the buffer and exits otherwise

However the HLIL and pseudo C de-compilations are very confusing:

HLIL:
Image

Pseudo C:

Image

Expected Behavior:
Binany ninja should understand that a0 is the only incoming register in this function and that it therefore only takes one Argument.

Screenshots/Video Recording:
The screenshots are placed in their appropriate place in the issue description.

Binary:
glow circle serves neatly base offset is 0x20000000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions