From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E563385DC26; Wed, 23 Aug 2023 19:57:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E563385DC26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692820623; bh=aBNdgisrd4H1/0Cy3rRqmtrccWuj+t4OBMIAnxc/tkk=; h=From:To:Subject:Date:From; b=VcdmBjoamstzoB+RB5UoGfYaE8foJgX8TtQKF9rOaNsnfD5s/EbBLUl1TmwdH1C4y dFOMHWluuUDfylnCwwNKwAsDtZzfZDEUJcKI6zntf6MarpjVa4b9WJ28e2ODHMEmC1 7LSSvqzmuc1ZsgBbSJsFkbzpMzbIg15wxgoum9Qw= From: "agriff at tin dot it" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111123] New: Warning about "used uninitialized" member shown or hidden randomly Date: Wed, 23 Aug 2023 19:57:02 +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: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: agriff at tin dot it 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=3D111123 Bug ID: 111123 Summary: Warning about "used uninitialized" member shown or hidden randomly Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: agriff at tin dot it Target Milestone: --- This code should warning (with -Wall) about the use of `border` that is uninitialized #include #include struct Camera { struct P2d { float x, y; }; std::vector clip_area; float border =3D 10.f; int z =3D 3; Camera() : clip_area({{border, border}, {1-border, border}, {1-border, 1-border}, {border, 1-border}}) { } }; int main() { Camera c; printf("%.18g\n", c.clip_area[0].x); } However does so only if member `z` is present; commenting out the line `int= z =3D 3;` silences the warning. This show/hide of the warning happens also pseudo-randomly in other cases (while I was trying to get the minimum code showing the problem I found many cases in which removing even an executable statement in the body of a method triggered the behavior change).=