public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "panigstein at hotmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108993] Value initialization does not occur for derived class , for gcc versions > 5 Date: Thu, 20 Apr 2023 19:25:44 +0000 [thread overview] Message-ID: <bug-108993-4-DKwN1rOJde@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108993-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108993 --- Comment #6 from Pablo Anigstein <panigstein at hotmail dot com> --- (In reply to Jonathan Wakely from comment #3) > (In reply to Pablo Anigstein from comment #2) > > (In reply to Andrew Pinski from comment #1) > > > Hmm, > > > I noticed that since GCC 7 with -std=c++17, the b.x is not initialized at > > > all. So the question I have is there a difference between C++ standards here? > > Derived is an aggregate in C++17, so b{} does aggregate init, not value init. > > > > Note the issue is we call Base's constructor after doing the zero > > > initialization and the Base's constructor has a clobber in it which I think > > > is correct. > > Maybe we should only clobber in the complete object constructor _ZN4BaseC1Ev > and not in _ZN4BaseC2Ev. > > > > This is all front-end generation and not exactly related to the > > > optimizations directly. > > > > There is no difference between C++ standards in this respect. > > Before C++11 there was no zero-init at all. Since C++11 the spec keeps > changing, but the effects of zero-init are substantially the same. But > Derived is an aggregate since C++17. Thank you for the correction. I still think there is non-conformance for all standards including C++17, I will post a modified example in a comment below. > > Aside: What does the comment "not a default constructor" mean in the > testcase? I guess he meant "user-provided".
next prev parent reply other threads:[~2023-04-20 19:25 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-02 18:12 [Bug c++/108993] New: Value initialization does not occur for derived class with -Os, " daniel.gotsch at bluerivertech dot com 2023-03-02 20:42 ` [Bug c++/108993] Value initialization does not occur for derived class , " pinskia at gcc dot gnu.org 2023-04-19 22:17 ` panigstein at hotmail dot com 2023-04-20 8:51 ` redi at gcc dot gnu.org 2023-04-20 8:57 ` redi at gcc dot gnu.org 2023-04-20 9:08 ` redi at gcc dot gnu.org 2023-04-20 19:25 ` panigstein at hotmail dot com [this message] 2023-04-20 19:32 ` panigstein at hotmail dot com 2023-04-20 19:33 ` pinskia at gcc dot gnu.org 2023-04-21 8:29 ` redi at gcc dot gnu.org 2023-04-21 9:34 ` m.cencora at gmail dot com 2023-04-21 9:45 ` m.cencora at gmail dot com 2023-04-21 10:41 ` redi at gcc dot gnu.org 2023-04-21 10:49 ` redi at gcc dot gnu.org 2023-04-21 10:57 ` m.cencora at gmail dot com 2023-10-12 16:34 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108993-4-DKwN1rOJde@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).