From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A56F0385DC14; Mon, 16 Nov 2020 01:22:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A56F0385DC14 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/97840] [11 regression] Bogus -Wmaybe-uninitialized Date: Mon, 16 Nov 2020 01:22:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: build X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2020 01:22:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97840 --- Comment #5 from Martin Sebor --- The warning code considers more that just TYPE_EMPTY_P(): /* Avoid warning about empty types such as structs with no members. The first_field() test is important for C++ where the predicate alone isn't always sufficient. */ tree rhstype =3D TREE_TYPE (rhs); if (POINTER_TYPE_P (rhstype)) rhstype =3D TREE_TYPE (rhstype); if (TYPE_EMPTY_P (rhstype) || (RECORD_OR_UNION_TYPE_P (rhstype) && (!first_field (rhstype) || default_is_empty_record (rhstype)))) return NULL_TREE; If the struct has no data members the warning shouldn't trigger even if TYPE_EMPTY_P() is false. I don't think std::allocator has data members so = we need to see why the check isn't good enough. Ah, it looks like the whole condition is false because default_is_empty_record (rhstype) is false, whic= h is because TREE_ADDRESSABLE (rhstype) is true. Is that what has changed with = your patch? Either way, I do agree that the warning shouldn't be sensitve to ABI nuances so perhaps default_is_empty_type() (rhstype) would be a better API = to use here (except it's static). Let me look into that.=