The result of & or | with a constant is compared with a value it can never equal

tx0/cpp:impossible-mask-comparisonstrictwarningreliability/control-flowdepth fastbug, cwe-570

What it finds

(flags & 0x0f) == 0x10 or (mode | 4) == 2: the value compared with has bits that the masked side can never have, or lacks bits it always has, so the comparison is always false, or with != always true. Usually the mask or the value is wrong.

The mask and the value must be constants written with literals and not negative.

From the rule's source, impossible_mask_comparison.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/cpp:impossible-mask-comparison" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/cpp:impossible-mask-comparison] reason="..."

tx0 explain tx0/cpp:impossible-mask-comparison shows the same in the terminal. Found a false positive? Report it.