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++/108597] [11/12/13 Regression] internal compiler error with -Wduplicated-cond
Date: Tue, 31 Jan 2023 16:55:03 +0000	[thread overview]
Message-ID: <bug-108597-4-Nyq4gzJJ9F@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108597-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:07ef737cf1ab08f5c36786c7ab1ffc596fe52138

commit r12-9093-g07ef737cf1ab08f5c36786c7ab1ffc596fe52138
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Jan 31 11:54:03 2023 -0500

    c++: fix ICE with -Wduplicated-cond [PR107593]

    Here we crash because a CAST_EXPR, representing T(), doesn't have
    its operand, and operand_equal_p's STRIP_ANY_LOCATION_WRAPPER doesn't
    expect that.  (o_e_p is called from warn_duplicated_cond_add_or_warn.)

    In the past we've adjusted o_e_p to better cope with template codes,
    but in this case I think we just want to avoid attempting to warn
    about inst-dependent expressions; I don't think I've ever envisioned
    -Wduplicated-cond to warn about them.  Also destroy the chain when
    an inst-dependent expression is encountered to not warn in
    Wduplicated-cond4.C.

    The ICE started with r12-6022, two-stage name lookup for overloaded
    operators, which gave dependent operators a TREE_TYPE (in particular,
    DEPENDENT_OPERATOR_TYPE), so we no longer bail out here in o_e_p:

      /* Similar, if either does not have a type (like a template id),
         they aren't equal.  */
      if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1))
        return false;

            PR c++/107593
            PR c++/108597

    gcc/c-family/ChangeLog:

            * c-common.h (instantiation_dependent_expression_p): Declare.
            * c-warn.cc (warn_duplicated_cond_add_or_warn): If the condition
            is dependent, invalidate the chain.

    gcc/c/ChangeLog:

            * c-objc-common.cc (instantiation_dependent_expression_p): New.

    gcc/cp/ChangeLog:

            * cp-tree.h (instantiation_dependent_expression_p): Don't
            declare here.

    gcc/testsuite/ChangeLog:

            * g++.dg/warn/Wduplicated-cond3.C: New test.
            * g++.dg/warn/Wduplicated-cond4.C: New test.
            * g++.dg/warn/Wduplicated-cond5.C: New test.

  parent reply	other threads:[~2023-01-31 16:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30 12:11 [Bug c++/108597] New: " mserdarsanli at gmail dot com
2023-01-30 12:15 ` [Bug c++/108597] " mserdarsanli at gmail dot com
2023-01-30 12:44 ` [Bug c++/108597] [11/12/13 Regression] " pinskia at gcc dot gnu.org
2023-01-30 14:05 ` mpolacek at gcc dot gnu.org
2023-01-31 16:37 ` cvs-commit at gcc dot gnu.org
2023-01-31 16:55 ` cvs-commit at gcc dot gnu.org [this message]
2023-01-31 16:55 ` mpolacek 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-108597-4-Nyq4gzJJ9F@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).