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++/100111] [10/11 Regression] `-fno-elide-constructors` with `constexpr` ctors causes ICE in GCC 10.3 Date: Fri, 16 Apr 2021 09:04:12 +0000 [thread overview] Message-ID: <bug-100111-4-anEIjRbKxa@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100111-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100111 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The ICE is during ((struct j *) this)->e = 0 evaluation and the problem seems to be that *valp, which is CONSTRUCTOR for the a variable initializer, is {.h={}} where the type of the inner {} is b rather than j. That invalid CONSTRUCTOR elt seems to have been inserted when cxx_eval_store_expression *(struct b *) this = *(const struct b &) (const struct b *) &k; I wonder if the bug isn't in: /* Don't share a CONSTRUCTOR that might be changed later. */ init = unshare_constructor (init); if (*valp && TREE_CODE (*valp) == CONSTRUCTOR && TREE_CODE (init) == CONSTRUCTOR) { /* An outer ctx->ctor might be pointing to *valp, so replace its contents. */ if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (init), TREE_TYPE (*valp))) { /* For initialization of an empty base, the original target will be *(base*)this, evaluation of which resolves to the object argument, which has the derived type rather than the base type. In this situation, just evaluate the initializer and return, since there's no actual data to store. */ gcc_assert (is_empty_class (TREE_TYPE (init)) && !lval); return init; } CONSTRUCTOR_ELTS (*valp) = CONSTRUCTOR_ELTS (init); TREE_CONSTANT (*valp) = TREE_CONSTANT (init); TREE_SIDE_EFFECTS (*valp) = TREE_SIDE_EFFECTS (init); CONSTRUCTOR_NO_CLEARING (*valp) = CONSTRUCTOR_NO_CLEARING (init); } else *valp = init; where we do that if (!same_type_ignoring... check and early out only if *valp, but in this case *valp is NULL and so we do the *valp = init; , except that it is still empty class store with !lval. While TREE_TYPE (*valp) can't be checked obviously, type can.
next prev parent reply other threads:[~2021-04-16 9:04 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-16 5:37 [Bug c++/100111] New: `-fno-elide-constructors` " lh_mouse at 126 dot com 2021-04-16 7:36 ` [Bug c++/100111] [10/11 Regression] `-fno-elide-constructors` with `constexpr` ctors " rguenth at gcc dot gnu.org 2021-04-16 8:14 ` jakub at gcc dot gnu.org 2021-04-16 9:04 ` jakub at gcc dot gnu.org [this message] 2021-04-16 10:16 ` jakub at gcc dot gnu.org 2021-04-16 11:11 ` lh_mouse at 126 dot com 2021-04-16 14:01 ` lh_mouse at 126 dot com 2021-04-16 14:10 ` jason at gcc dot gnu.org 2021-04-16 15:44 ` cvs-commit at gcc dot gnu.org 2021-04-17 3:33 ` [Bug c++/100111] [10 " jason at gcc dot gnu.org 2021-04-20 9:46 ` cvs-commit at gcc dot gnu.org 2021-04-20 9:53 ` jakub at gcc dot gnu.org 2022-04-13 14:18 ` cvs-commit at gcc dot gnu.org 2022-05-06 20:30 ` cvs-commit at gcc dot gnu.org 2022-05-12 20:13 ` cvs-commit at gcc dot gnu.org 2022-05-12 21:15 ` cvs-commit 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-100111-4-anEIjRbKxa@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).