[Bug c++/101780] Missing initializers whereas structure has default initializers

deco33000 at yandex dot com gcc-bugzilla@gcc.gnu.org
Thu Aug 5 14:17:49 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101780

--- Comment #2 from KL <deco33000 at yandex dot com> ---
(In reply to Jonathan Wakely from comment #1)

Thanks,

I thought that this warning is fine if it helps to assure the developer that
everything is still under control: that if the analyzer sees that a field is
left uninitialized (with no default value), it should tell it in this warning.


> How would P,Q,R be left uninitialized?

Only if the analyzer has the info that, at this stage, there no default value
for the field. 
It could be interesting in the context of a partially initialized struct (by
mistake, intended by the developer?)?

It help with quality of code.

> It doesn't say anything about undefined behaviour.

In case the developer forgot to properly initialize a member, it *can* lead to
undefined behavior. So, it is good from the compiler to warn about it as well.


More information about the Gcc-bugs mailing list