A loop counter of type char or short is compared with a wider bound, so it may wrap around before reaching it

tx0/cpp:loop-variable-too-smallrecommendedwarningreliability/control-flowdepth fastbug

What it finds

When the bound can exceed the range of the counter, as an int or a size() can for a short, the counter overflows and wraps, and the loop never ends or skips elements. The counter needs at least the type of its bound.

From the rule's source, loop_variable_too_small.rs.

Turn it on, off or suppress it

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

tx0.toml
[rules]
"tx0/cpp:loop-variable-too-small" = "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:loop-variable-too-small] reason="..."

tx0 explain tx0/cpp:loop-variable-too-small shows the same in the terminal. Found a false positive? Report it.