public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105035] [11/12 Regression] tree check: expected field_decl,  have identifier_node in operand_equal_p, at fold-const.c:3335 since r11-5181-g0862d007b564eca8
Date: Wed, 23 Mar 2022 13:45:58 +0000	[thread overview]
Message-ID: <bug-105035-4-LiFtWBmqSH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105035-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #6)
> (In reply to Jakub Jelinek from comment #3)
> > Another option is to make sure we don't call warn_duplicated_cond_add_or_warn
> > when processing_template_decl or say when value_dependent_expression_p or
> > similar, and instead call it during template instantiation in pt.cc after
> > finish_if_stmt_cond call there.
> 
> I noticed the warning already gives up on conditions that have
> TREE_SIDE_EFFECTS set, so I suppose it makes sense to do the same for
> type-dependent expressions since we can't know if they have side effects
> until instantiation time.

However, doing the check at instantiation time for dependent conditions might
be problematic since two different dependent conditions could instantiate to
the same non-dependent condition, and I don't think we'd want to issue a
-Wduplicated-cond warning in this case.  For example,

template<class T, class U>
void f() {
  if (T() == 5)
    ...
  else if (U() == 5)
    ...
}

I'm not sure issuing a warning at instantiation time for f<int, int>() would be
appropriate.  We'd might have to compare the dependent conditions even at
instantiation time, provided that the instantiated condition doesn't have
TREE_SIDE_EFFECTS set...  Seems quite messy to get right.

  parent reply	other threads:[~2022-03-23 13:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  8:28 [Bug c++/105035] New: regression ICE segmentation fault with -Wduplicated-cond dimitar.yordanov at sap dot com
2022-03-23 10:16 ` [Bug c++/105035] [11/12 Regression] tree check: expected field_decl, have identifier_node in operand_equal_p, at fold-const.c:3335 since r11-5181-g0862d007b564eca8 marxin at gcc dot gnu.org
2022-03-23 11:06 ` rguenth at gcc dot gnu.org
2022-03-23 11:06 ` rguenth at gcc dot gnu.org
2022-03-23 12:34 ` jakub at gcc dot gnu.org
2022-03-23 12:36 ` rguenther at suse dot de
2022-03-23 12:50 ` jakub at gcc dot gnu.org
2022-03-23 13:13 ` ppalka at gcc dot gnu.org
2022-03-23 13:45 ` ppalka at gcc dot gnu.org [this message]
2022-03-24 11:24 ` cvs-commit at gcc dot gnu.org
2022-03-24 11:31 ` [Bug c++/105035] [11 " jakub at gcc dot gnu.org
2022-03-29  5:54 ` cvs-commit at gcc dot gnu.org
2022-03-30  8:17 ` 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-105035-4-LiFtWBmqSH@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).