IDA shows multiple goto statements in the decompiled pseudocode. I've read this manual page: https://www.hex-rays.com/products/decompiler/manual/config.shtml and tried to disable/enable these flags MAX_NCOMMAS, HO_FAST_STRUCTURAL, HO_UNMERGE_TAILS in cfg/hexrays.cfg file. But it doesn't change anything in the pseudocode.

  • In that case, Hex-rays may simply not smart enough to eliminate all goto's.
    – user202729
    Dec 1 '18 at 13:11
  • It does? I don't see the manual shows that. It only says that number of goto may be reduced.
    – user202729
    Dec 1 '18 at 13:21

The functionality you mentioned is Max commas. .

  • Edit > Plugins > Hex-ray decompiler > Options > Max commas (default is 8).

Decrease value: Hexray uses "goto" statement instead of conditions inside single "if" statement.
Increase: Hexray uses "if" statement instead of nested "goto" statement.

However, This is matter of representation, and does not mean remove all "goto" statement.


If Hex-Rays had a way to remove all goto statements in the decompilation, then it simply would not generate goto statements in the first place. There is no option to do what you are asking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.