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 tree-optimization/101515] [11/12 Regression] ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128 since r11-6729-gadb520606ce3e1e1 Date: Sat, 19 Mar 2022 07:42:34 +0000 [thread overview] Message-ID: <bug-101515-4-9InI9UkAWf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101515-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101515 --- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:2663d18356b0a62f5a800c7e5596d814cd3c2c41 commit r12-7720-g2663d18356b0a62f5a800c7e5596d814cd3c2c41 Author: Jakub Jelinek <jakub@redhat.com> Date: Sat Mar 19 08:40:47 2022 +0100 c-family: Fix up ICE during pretty-printing of PMF related expression [PR101515] The intent of r11-6729 is that it prints something that helps user to figure out what exactly is being accessed. When we find a unique non-static data member that is being accessed, even when we can't fold it nicely, IMNSHO it is better to print ((sometype *)&var)->field or (*(sometype *)&var).field instead of *(fieldtype *)((char *)&var + 56) because the user doesn't know what is at offset 56, we shouldn't ask user to decipher structure layout etc. One question is if we could return something better for the TYPE_PTRMEMFUNC_FLAG RECORD_TYPE members here (something that would print it more naturally/readably in a C++ way), though the fact that the routine is in c-family makes it harder. Another one is whether we shouldn't punt for FIELD_DECLs that don't have nicely printable name of its containing scope, something like: if (tree scope = get_containing_scope (field)) if (TYPE_P (scope) && TYPE_NAME (scope) == NULL_TREE) break; return cop; or so. This patch implements that. Note the returned cop is a COMPONENT_REF where the first argument has a nicely printable type name (x with type sp), but sp's TYPE_MAIN_VARIANT is the unnamed TYPE_PTRMEMFUNC_FLAG. So another possibility would be if we see such a problem for the FIELD_DECL's scope, check if TYPE_MAIN_VARIANT of the first COMPONENT_REF's argument is equal to that scope and in that case use TREE_TYPE of the first COMPONENT_REF's argument as the scope instead. 2022-03-19 Jakub Jelinek <jakub@redhat.com> PR c++/101515 * c-pretty-print.cc (c_fold_indirect_ref_for_warn): For C++ don't return COMPONENT_REFs with FIELD_DECLs whose containing scope can't be printed. * g++.dg/warn/pr101515.C: New test.
next prev parent reply other threads:[~2022-03-19 7:42 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-19 17:27 [Bug c++/101515] New: [11/12 Regression] ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128 gscfq@t-online.de 2021-07-19 17:31 ` [Bug tree-optimization/101515] " pinskia at gcc dot gnu.org 2021-07-22 13:13 ` [Bug tree-optimization/101515] [11/12 Regression] ICE in pp_cxx_unqualified_id, at cp/cxx-pretty-print.c:128 since r11-6729-gadb520606ce3e1e1 marxin at gcc dot gnu.org 2021-07-28 7:07 ` rguenth at gcc dot gnu.org 2022-01-17 14:00 ` rguenth at gcc dot gnu.org 2022-02-04 21:53 ` qinzhao at gcc dot gnu.org 2022-02-07 21:14 ` qinzhao at gcc dot gnu.org 2022-02-07 21:17 ` qinzhao at gcc dot gnu.org 2022-02-10 21:58 ` qinzhao at gcc dot gnu.org 2022-03-19 7:42 ` cvs-commit at gcc dot gnu.org [this message] 2022-03-19 7:43 ` [Bug tree-optimization/101515] [11 " jakub at gcc dot gnu.org 2022-03-29 5:54 ` cvs-commit at gcc dot gnu.org 2022-03-30 8:16 ` 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-101515-4-9InI9UkAWf@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).