On 06/06/14 09:00, Florian Weimer wrote:
The attached crude patch as an -finit-local-vars option to the C front
end. If active, all local variables are initialized to zero. It is
part of an experiment to assess the performance impact of local variable
initialization.
I'd expect impact to be minimal -- especially for objects which are
SSA_NAMEs.
This is not a real patch submission because the way the flag is
implemented, it interferes with unused-variable warnings. I just want
to archive it for posterity.
This is the big issue. As is the fact that initializing to zero isn't
necessarily is good/safe thing to do and may ultimately end up masking
real bugs.
To know the right initialization value you have to know how the object
is used and it's probably outside the scope of what the compiler can
determine.
Really the way forward is to continue to improve the uninit variable
warnings to give fewer false positives *and* to find a sane way to give
uninit warnings for objects that aren't SSA_NAMEs.
Jeff