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/107002] [13 Regression] ICE in column_range, at diagnostic-show-locus.cc:2236 since r13-2386-gbedfca647a9e9c1a
Date: Tue, 28 Mar 2023 18:36:21 +0000	[thread overview]
Message-ID: <bug-107002-4-2hyOtcif2V@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107002-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:22c3a6c3c118283dfef1b9928dd21110098679b7

commit r13-6912-g22c3a6c3c118283dfef1b9928dd21110098679b7
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue Mar 28 14:34:49 2023 -0400

    Don't emit -Wxor-used-as-pow on macro expansions [PR107002]

    PR c/107002 reports an assertion failure from deep inside the
    diagnostic_shows_locus when attempting to print fix-it hints relating
    to -Wxor-used-as-pow.  The case involves macro expansions with
    -ftrack-macro-expansion=0.

    It doesn't seem to make much sense to emit this warning for macro
    expansions, so this patch updates the warning not to (which seems
    to also be clang's behavior).  The patch also adds some bulletproofing
    to diagnostic-show-locus.cc to be more robust against such invalid
    fix-it hints.

    Doing so fixes the ICE.

    gcc/c-family/ChangeLog:
            PR c/107002
            * c-common.h (check_for_xor_used_as_pow): Add "rhs_loc" param.
            * c-warn.cc (check_for_xor_used_as_pow): Add "rhs_loc" param.
            Reject cases where involving macro expansions.

    gcc/c/ChangeLog:
            PR c/107002
            * c-typeck.cc (parser_build_binary_op): Update for new param of
            check_for_xor_used_as_pow.

    gcc/cp/ChangeLog:
            PR c/107002
            * parser.cc (cp_parser_binary_expression): Update for new param of
            check_for_xor_used_as_pow.

    gcc/ChangeLog:
            PR c/107002
            * diagnostic-show-locus.cc (column_range::column_range): Factor
            out assertion conditional into...
            (column_range::valid_p): ...this new function.
            (line_corrections::add_hint): Don't attempt to consolidate hints
            if it would lead to invalid column_range instances.

    gcc/testsuite/ChangeLog:
            PR c/107002
            * c-c++-common/Wxor-used-as-pow-1.c: Add macro test.
            * c-c++-common/Wxor-used-as-pow-pr107002-0.c: New test.
            * c-c++-common/Wxor-used-as-pow-pr107002-1.c: New test.
            * c-c++-common/Wxor-used-as-pow-pr107002-2.c: New test.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

  parent reply	other threads:[~2023-03-28 18:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 17:36 [Bug c/107002] New: [13 Regression] ICE in column_range, at diagnostic-show-locus.cc:2236 gscfq@t-online.de
2022-09-22  6:48 ` [Bug c/107002] " rguenth at gcc dot gnu.org
2022-09-22 12:49 ` dmalcolm at gcc dot gnu.org
2022-09-22 19:25 ` [Bug c/107002] [13 Regression] ICE in column_range, at diagnostic-show-locus.cc:2236 since r13-2386-gbedfca647a9e9c1a marxin at gcc dot gnu.org
2022-10-18  8:42 ` rguenth at gcc dot gnu.org
2023-03-28 14:24 ` jakub at gcc dot gnu.org
2023-03-28 16:34 ` dmalcolm at gcc dot gnu.org
2023-03-28 18:36 ` cvs-commit at gcc dot gnu.org [this message]
2023-03-28 18:39 ` dmalcolm 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-107002-4-2hyOtcif2V@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).