From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 96B043858D37; Thu, 20 Apr 2023 19:25:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96B043858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682018744; bh=a8QEY5bqfTrhnj+uKBO/aPzDFDJ7XaLF/z9MnKQcLDE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BN/uKsVU+L1qlODV6cQm6olm2HWolrHOjZwAClPgrSSzqWylZmxr1kccjOZrrVWBv +7smjpsSiMVK8nhkFX0hvcADbN4WYPkjiSp4K1bZM6Tc1aoiumK8UUcVEWYOk3HKb0 TZv7y04zywSauMCq91jXScs5wgeVIDyWnLbwZJPQ= From: "panigstein at hotmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: panigstein at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108993 --- Comment #6 from Pablo Anigstein --- (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=3Dc++17, the b.x is not initial= ized at > > > all. So the question I have is there a difference between C++ standar= ds here? >=20 > Derived is an aggregate in C++17, so b{} does aggregate init, not value i= nit. >=20 > > > 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. >=20 > Maybe we should only clobber in the complete object constructor _ZN4BaseC= 1Ev > and not in _ZN4BaseC2Ev. >=20 > > > This is all front-end generation and not exactly related to the > > > optimizations directly. > >=20 > > There is no difference between C++ standards in this respect. >=20 > 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 belo= w. >=20 > Aside: What does the comment "not a default constructor" mean in the > testcase? I guess he meant "user-provided".=