A variable is changed twice, or changed and read, in one expression without a sequence point between
What it finds
i = i++, a[i] = i++ or f(n++, n): the order in which the parts of an expression are evaluated is not fixed, so changing a variable twice, or changing it and reading it elsewhere in the same expression, is undefined behavior; compilers give different results.
The expression must be a whole expression statement, return value, condition or initializer without &&, ||, ?: or the comma operator, which order their operands. Only plain variables the file declares count; the value on the right of an assignment may read the variable it assigns, as in x = x + 1. An expression that calls a function the file does not declare, which may be a macro, is left alone.
From the rule's source, unsequenced_modification.rs.
Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/cpp:unsequenced-modification" = "off"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:unsequenced-modification] reason="..."tx0 explain tx0/cpp:unsequenced-modification shows the same in the terminal. Found a false positive? Report it.