From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B8D01385735F; Tue, 4 Oct 2022 00:38:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8D01385735F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664843899; bh=5VPsU3EbtuSygLK6WXtx0kQX5b3i2TShpExDET54cEw=; h=From:To:Subject:Date:From; b=ymzebyhISJ0rSiyXapOI1NHgTWfZt+uQ7a5LEVXfhFFirCijcVS0+wvxDJDfH3do/ nKG6ISlGJ8xygyl6wQ68sdxFBrAFjoJo1j6yu4klzF0lW0duQ3nXe1UXVi69GHONex kVizvzoylVnhkcRCCjVIhAY3ML4pSWdn5pLeH91U= From: "kip at thevertigo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107140] New: Potential false positive uninitialized variable warning with -Wmaybe-uninitialized Date: Tue, 04 Oct 2022 00:38:18 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kip at thevertigo 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: 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=3D107140 Bug ID: 107140 Summary: Potential false positive uninitialized variable warning with -Wmaybe-uninitialized Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kip at thevertigo dot com Target Milestone: --- I am aware there have been other related issues that have already been open= ed. I am not sure if this adds anything new to the discussion, but I have, with some effort, managed to isolate a minimal that reproduces the issue. This code is not meant to be run, but it's merely a heavily butchered minim= al to re-create a "'MaximumPriorityQueue' may be used uninitialized" warning. = This originates in Test.cpp on L71. Here is the code:=20 https://godbolt.org/z/a17Eoc3f3 This only appears to happen with >=3D -O2. My guess is this may be a result= of a complex interaction with the optimizer and how part of the instantiated template was inlined. I note that if I reorder m_LessThanComparison with m_MinMaxHeap in Test.cpp, the warning is suppressed.=