RED-expr
In this section:
Synopsis
Some expressions, such as x & x and x | x, are redundant.
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
Using one or more variable does not result in a change in that variable, or another variable, or some other side-effect. Giving two identical operands to a bitwise OR operator, for example, yields nothing, because the result is equal to the original operands. This might indicate that one of the variables is not intended to be used where it is used. This use of the operator is redundant.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
void example(int x) {
x = x;
}
The following code example passes the check and will not give a warning about this issue:
void example(int x) {
x = x ^ x; //OK - x is modified
}