public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub 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 12:34:33 +0000 [thread overview] Message-ID: <bug-105035-4-Zj53njthXq@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 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The C++ FE when parsing templates (processing_template_decl is true) produces a lot of trees the middle-end doesn't like. If they aren't type or value dependent, usually (but not always) the trees are such that they can be handed over to the generic code even when parsing templates. The -Wduplicated-cond warning implemented in PR64249 seems to do: condition = finish_if_stmt_cond (condition, statement); if (warn_duplicated_cond) warn_duplicated_cond_add_or_warn (token->location, condition, &chain); only in the parser regardless of processing_template_decl. So, the options are either to make sure at least operand_equal_p can cope even with those trees and apparently operand_equal_p already has such spots in it, e.g.: /* 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; So, in this particular case, we'd punt if either field0 or field1 is not a FIELD_DECL (this is in !OP_SAME (1) guarded code). 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 think because operand_equal_p already has code to deal with the C++ special trees and because it is such a low level API, changing it seems to be better.
next prev parent reply other threads:[~2022-03-23 12:34 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 [this message] 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 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-Zj53njthXq@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: linkBe 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).