public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107574] [10/11/12/13 Regression] ICE: tree check in cp_fold_convert with ptr to member field cast inside a class not completed and inherent since r9-50-gd760b06868d660bc
Date: Tue, 31 Jan 2023 23:42:44 +0000	[thread overview]
Message-ID: <bug-107574-4-mBSYlFZTqj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107574-4@http.gcc.gnu.org/bugzilla/>

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Are we sure we want to accept this?  I know we did, but that seems like an
accident (cp_fold_convert wasn't checking same_type_p).

Essentially it comes down to the fact that we're attempting to evaluate a
PTRMEM_CST in a class that hasn't been completed yet, but that doesn't work:

        /* We can't lower this until the class is complete.  */
        if (!COMPLETE_TYPE_P (DECL_CONTEXT (member)))
          return cst;

and then this unlowered PTRMEM_CST is used as EXPR in

    tree op1 = build_nop (ptrdiff_type_node, expr);

and we crash in cp_fold_convert which gets type=ptrdiff_type_node,
expr=PTRMEM_CST and does

  else if (TREE_CODE (expr) == PTRMEM_CST
           && same_type_p (TYPE_PTRMEM_CLASS_TYPE (type),
                           PTRMEM_CST_CLASS (expr)))

where TYPE_PTRMEM_CLASS_TYPE (type) is going to crash.  We could just add a
TYPE_PTRMEM_P check and go back to the GCC 7 error.

  parent reply	other threads:[~2023-01-31 23:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 17:25 [Bug c++/107574] New: [10/11/12/13 Regression] ICE: tree check: expected record_type or union_type or qual_union_type, have integer_type in cp_fold_convert, at cp/cvt.cc:613 gscfq@t-online.de
2022-11-08 17:37 ` [Bug c++/107574] " rguenth at gcc dot gnu.org
2022-11-08 17:43 ` [Bug c++/107574] [10/11/12/13 Regression] ICE: tree check in cp_fold_convert with ptr to member field cast inside a class not completed and inherent pinskia at gcc dot gnu.org
2022-11-08 17:45 ` pinskia at gcc dot gnu.org
2022-11-08 17:51 ` pinskia at gcc dot gnu.org
2022-11-21 12:04 ` [Bug c++/107574] [10/11/12/13 Regression] ICE: tree check in cp_fold_convert with ptr to member field cast inside a class not completed and inherent since r9-50-gd760b06868d660bc marxin at gcc dot gnu.org
2023-01-31 23:42 ` mpolacek at gcc dot gnu.org [this message]
2023-02-02 17:28 ` mpolacek at gcc dot gnu.org
2023-03-01 23:33 ` cvs-commit at gcc dot gnu.org
2023-03-01 23:34 ` [Bug c++/107574] [10/11/12 " mpolacek at gcc dot gnu.org
2023-03-04 17:51 ` cvs-commit at gcc dot gnu.org
2023-03-04 17:52 ` [Bug c++/107574] [10/11 " 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-107574-4-mBSYlFZTqj@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).