[PATCH] D148692: Fix uninitialized class members
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 12 09:57:27 PDT 2023
vitalybuka added a comment.
In D148692#4338165 <https://reviews.llvm.org/D148692#4338165>, @dblaikie wrote:
> Adding initializers to variables that don't need it (because through some dynamic path they are initialized before they're used) may hinder tools like msan from finding real bugs.
It's can be useful for local variables. But for class members, especially complex, when half members are already initialized, it's seems cont-productive. We will more often introduce bugs then catch some with msan. Unless it's not perf issue, I would rather see consistent initialized state.
Dynamic checks do not cover all cases in testing, plus optimizations suppress some bugs.
Fopr logical bug I would rather recommend to set default to some invalid value, and then assert() or diagnostics.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148692/new/
https://reviews.llvm.org/D148692
More information about the llvm-commits
mailing list