Version and Platform (required):
- Binary Ninja Version: 5.4.9755-dev Ultimate, fc27395f
- OS: macos
- OS Version: 26.5.1
- CPU Architecture: arm64
Bug Description:
Under certain circumstances, based on surrounding tokens, using an enum that decomposes to more than one member OR'd together results in a code representation that is wrong.
Example
Original Source
if ((flags & (DEL_DIR | DEL_RECURSE)) == (DEL_DIR | DEL_RECURSE))
{
myDelete(buf,flags);
}
Binary Ninja HLIL
00405b98 else if ((flags.b & DEL_DIR | DEL_RECURSE) == DEL_DIR | DEL_RECURSE)
00405ba8 myDelete(buf: buf, flags: flags)
According to precedence, the HLIL parses as the following which is logically different from the original code.
(((flags.b & DEL_DIR) | DEL_RECURSE) == DEL_DIR) | DEL_RECURSE
Steps To Reproduce:
- Open this database:
just brook strikes fluently
- Look at HLIL here:
0x405b98
Expected Behavior:
Add parens as needed to make sure the result doesn't have a subtle precedence problem.
Screenshots:

Binary:
Database: just brook strikes fluently
Version and Platform (required):
Bug Description:
Under certain circumstances, based on surrounding tokens, using an enum that decomposes to more than one member OR'd together results in a code representation that is wrong.
Example
Original Source
Binary Ninja HLIL
According to precedence, the HLIL parses as the following which is logically different from the original code.
Steps To Reproduce:
just brook strikes fluently0x405b98Expected Behavior:
Add parens as needed to make sure the result doesn't have a subtle precedence problem.
Screenshots:

Binary:
Database:
just brook strikes fluently