Given the following source code class K { public: K * copy(); }; class FunctionExpr { public: FunctionExpr( const FunctionExpr & ); private: K * args; }; FunctionExpr::FunctionExpr(const FunctionExpr& expr) : args(expr.args ? args->copy() : 0) { } then trunk gcc can't detect the read of uninit memory for args->copy. $ ~/gcc/results/bin/gcc -c -g -O2 -Wall -Wextra -pedantic bug189.cc $ Here is clang doing the right thing: $ ~/llvm/results/bin/clang++ -c -g -O2 -Wall -Wextra -pedantic bug189.cc bug189.cc:18:28: warning: field 'args' is uninitialized when used here [-Wuninitialized] : args(expr.args ? args->copy() : 0) ^ 1 warning generated. $
Yes, this is well known and a dup of another bug, maybe several.
I pointed out other similar cases in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18016#c9 when fixing the simple case of args(args)
I think this is relatively easy to fix (seehttps://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808#c24). I think Anthony mentioned to me that he got it mostly working, but I haven't heard from him in a while. *** This bug has been marked as a duplicate of bug 19808 ***