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++/71885] Incorrect code generated with -01, memset() function call is missing


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

--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to hyc from comment #14)
> "If no initialization is performed" - this is the constructor, whose job is
> to create and initialize the object, and you're preventing that
> initialization from happening. How is that logical?

The constructor doesn't do any initialization. That's the problem.

(In reply to hyc from comment #15)
> This bug report is talking about a store that occurs *during* the
> constructor. This does not *precede* the constructor.

That's entirely incorrect. The initialization in the buggy code is done in
operator new, which runs *before* the constructor.

If the initialization was done in the constructor the code would not have
undefined behaviour and would work correctly.

Please try to understand the issue before ranting about time well spent.

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