public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <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: Fri, 05 Nov 2021 00:26:00 +0000	[thread overview]
Message-ID: <bug-102967-4-usprOMvxG7@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 #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
Both for the purposes of the warning (which can be more restrictive than what
the language considers valid), and in the C language, the semantics of the ->
expression depend on the first operand designating an object.  In C they're
defined like so:

  A postfix expression followed by the -> operator and an identifier designates
a member of a structure or union object.  The value is that of the named member
of the object to which the first expression points, and is an lvalue. 106)

Footnote 106) If &E is a valid pointer expression (where & is the "address-of"
operator, which generates a pointer to its operand), the expression (&E)->MOS
is the same as E.MOS .

  parent reply	other threads:[~2021-11-05  0:26 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
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 [this message]
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-usprOMvxG7@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: link
Be 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).