A variable is initialized with its own value, which is indeterminate at that point

tx0/c:self-initializationrecommendedwarningreliability/memory-safetydepth fastbug, cwe-457

What it finds

int count = count;: a variable's scope starts at its declarator, so the initializer reads the new variable, whose value is still indeterminate, and not one of the same name further out. Some code writes it to quiet warnings about uninitialized use, which hides real ones.

From the rule's source, self_initialization.rs.

Example from the rule's tests
int count_up(int n){  int total = total;tx0 reports: total is initialized with itself  int other = n;  return total + other;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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/c:self-initialization" = "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/c:self-initialization] reason="..."

tx0 explain tx0/c:self-initialization shows the same in the terminal. Found a false positive? Report it.