public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andrew.cooper3 at citrix dot com" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-102967-4-rO8oaAH4P0@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102967-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102967 --- Comment #2 from Andrew Cooper <andrew.cooper3 at citrix dot com> --- (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: > > if ( !(pa ? &pa->c : NULL) ) > ^^^^^^ > > 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 can > be simplified to > > 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.
next prev parent reply other threads:[~2021-10-27 19:14 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-27 18:14 [Bug c/102967] New: -Waddress with nested structures: Incorrect "the comparison will always evaluate as 'true'" andrew.cooper3 at citrix dot com 2021-10-27 18:55 ` [Bug c/102967] confusing location in -Waddress for a subexpression of a ternary expression msebor at gcc dot gnu.org 2021-10-27 19:14 ` andrew.cooper3 at citrix dot com [this message] 2021-11-04 12:12 ` jbeulich at suse dot com 2021-11-04 15:35 ` msebor at gcc dot gnu.org 2021-11-04 15:51 ` jbeulich at suse dot com 2021-11-04 16:35 ` schwab@linux-m68k.org 2021-11-05 0:26 ` msebor at gcc dot gnu.org 2022-05-27 9:36 ` jbeulich at suse dot com 2022-09-19 19:57 ` amachronic at protonmail dot com 2024-03-11 12:34 ` pinskia at gcc dot gnu.org 2024-04-05 18:03 ` pinskia at gcc dot gnu.org 2024-04-05 18:04 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-102967-4-rO8oaAH4P0@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).