[Bug c++/2972] -Wuninitialized could warn about uninitialized member variable usage in constructors
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 29 14:54:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2972
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #21 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #20)
> Perhaps a better alternative is to warn only if the uninitialized member is
> used in a mem-initializer. Then, when building the constructor call, mark
> the uninitialized members somehow as uninitialized for the middle-end, and
> let the middle-end handle the cases in the body of the constructor. The
> first part would already fix PR19808. The second part will fix this bug with
> fewer false positives than the proposed patch.
And this comment gives some ideas:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19808#c9
Richard B, you say that: "using <error-mark> [for marking undefined memory] is
just a random (and probably bad) idea." Intuitively this seems more scalable,
since one could propagate the undefined value like VRP does.
The other alternative "Introducing a SSA name default definition for A (even
though not of register type)", however, seems possible already. no? We do
already check for default definitions in virtual operands, tree-ssa-uninit.c
says:
/* For memory the only cheap thing we can do is see if we
have a use of the default def of the virtual operand.
So what is missing here?
More information about the Gcc-bugs
mailing list