This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/2972] -Wuninitialized could warn about uninitialized member variable usage in constructors


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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]