================
@@ -431,6 +431,12 @@ class DeadStoreObs : public LiveVariables::Observer {
// bug.
if (isa<ParmVarDecl>(VD) && VD->getType()->isScalarType())
return;
+ // Special case: check for self-initializations.
+ //
+ // e.g. int x = x;
+ //
+ if (VD == V)
----------------
Snape3058 wrote:
This is not checked by the deadcode.DeadStores checker.
```
void DeadStoreObs::CheckVarDecl(const VarDecl *VD, ...) ...
```
For the uninitialized variable checker, this actually leads to a false negative
now.
```
struct S { int x = x; };
int foo() {
S s;
return s.x;
}
```
The uninitialized read to `s.x` is not reported. But I think that this FN needs
to be considered in another PR.
Besides, this case is currently warned by the frontend warnings.
https://github.com/llvm/llvm-project/pull/187530
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits