public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/115290] [12 Regression] tree check fail in c_tree_printer, at c/c-objc-common.cc:330
Date: Thu, 20 Jun 2024 08:54:48 +0000	[thread overview]
Message-ID: <bug-115290-4-NEJzHhZdNM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115290-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115290

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8f612e6559b39569747894ec0f8b4694b96492a7

commit r12-10568-g8f612e6559b39569747894ec0f8b4694b96492a7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Mon Jun 17 19:24:05 2024 +0200

    c-family: Fix -Warray-compare warning ICE [PR115290]

    The warning code uses %D to print the ARRAY_REF first operands.
    That works in the most common case where those operands are decls, but
    as can be seen on the following testcase, they can be other expressions
    with array type.
    Just changing %D to %E isn't enough, because then the diagnostics can
    suggest something like
    note: use '&(x) != 0 ? (int (*)[32])&a : (int (*)[32])&b[0] == &(y) != 0 ?
(int (*)[32])&a : (int (*)[32])&b[0]' to compare the addresses
    which is a bad suggestion, the %E printing doesn't know that the
    warning code will want to add & before it and [0] after it.
    So, the following patch adds ()s around the operand as well, but does
    that only for non-decls, for decls keeps it as &arr[0] like before.

    2024-06-17  Jakub Jelinek  <jakub@redhat.com>

            PR c/115290
            * c-warn.cc (do_warn_array_compare): Use %E rather than %D for
            printing op0 and op1; if those operands aren't decls, also print
            parens around them.

            * c-c++-common/Warray-compare-3.c: New test.

    (cherry picked from commit b63c7d92012f92e0517190cf263d29bbef8a06bf)

  parent reply	other threads:[~2024-06-20  8:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30  7:50 [Bug c/115290] New: " dcb314 at hotmail dot com
2024-05-30 14:50 ` [Bug c/115290] [12/13/14/15 Regression] " pinskia at gcc dot gnu.org
2024-05-31  6:45 ` rguenth at gcc dot gnu.org
2024-06-17 13:20 ` jakub at gcc dot gnu.org
2024-06-17 17:24 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:27 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:28 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:30 ` [Bug c/115290] [12 " jakub at gcc dot gnu.org
2024-06-20  8:54 ` cvs-commit at gcc dot gnu.org [this message]
2024-06-20  9:15 ` rguenth at gcc dot gnu.org
2024-06-20  9:32 ` jakub 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-115290-4-NEJzHhZdNM@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).