From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B06D43858428; Mon, 21 Aug 2023 16:18:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B06D43858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692634687; bh=JFRidqcq5RhOTB3sgpSbmvymhQcMPCMF9Ov8jjT+LEI=; h=From:To:Subject:Date:From; b=gVmTY7tWy1Gwt3b7j9sEJVUPbr2hB2KYpEU81yRhfV2Fze23XV0TZaDLEbOKlM7gV /c3xpd4cht6u2+UbsaqZeMD+ONac+agPdiOgCkD2uoAbPc8a4VN08GYDT4vHjJ9E/b aTmKcsMKpCtLeQ6W5PdD6pko/++Goihr+JQXxGV4= From: "ed at catmur dot uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111090] New: Bogus -Wuninitialized for trivial copy of nested struct with partially initialized array Date: Mon, 21 Aug 2023 16:18:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ed at catmur dot uk 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D111090 Bug ID: 111090 Summary: Bogus -Wuninitialized for trivial copy of nested struct with partially initialized array Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- struct A { A() { buf[0] =3D 0; } int buf[2]; }; struct B { A a; }; struct C { C(B const& b) : b(b) {} B b; }; struct D { D(C c) : c(c) {} C c; }; D f() { return D(C(B())); } In constructor 'C::C(const B&)', inlined from 'D f()' at :14:16: :7:21: warning: '.B::a.A::a[1]' is used uninitialized [-Wuninitialized] 7 | C(B const& b) : b(b) {} | ^~~~ : In function 'D f()': :14:22: note: '' declared here 14 | D f() { return D(C(B())); } | ^ This appears to have started in 7.1.=