From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E67DF3858415; Wed, 27 Oct 2021 19:14:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E67DF3858415 From: "andrew.cooper3 at citrix dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/102967] confusing location in -Waddress for a subexpression of a ternary expression Date: Wed, 27 Oct 2021 19:14:41 +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.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: andrew.cooper3 at citrix dot com 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: Wed, 27 Oct 2021 19:14:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102967 --- Comment #2 from Andrew Cooper --- (In reply to Martin Sebor from comment #1) > The warning is intended: it points out that the second operand of the > conditional expression is necessarily true: >=20 > if ( !(pa ? &pa->c : NULL) ) > ^^^^^^ >=20 > There's no point in testing the address of a member for equality to null > because the member of no object can reside at that address. The above c= an > be simplified to >=20 > if (!pa) Hmm, true. I suppose I got hung up on the statement made by the diagnostic, rather than the implication that a simplification could be made. Moving the underlining would certainly help. > When reporting bugs, please be sure to include the full test case and its > output as requested at https://gcc.gnu.org/bugs/#need. My apologies. I'll try to be better next time.=