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 c++/98295] [8/9/10 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 Date: Tue, 02 Feb 2021 05:38:52 +0000 [thread overview] Message-ID: <bug-98295-4-Jw5TXWcA3P@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98295-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98295 --- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:a4f8e2fc771bea21aaac44433e75510362e208c1 commit r10-9335-ga4f8e2fc771bea21aaac44433e75510362e208c1 Author: Patrick Palka <ppalka@redhat.com> Date: Mon Feb 1 10:27:45 2021 -0500 c++: Fix ICE from verify_ctor_sanity [PR98295] In this testcase we're crashing during constexpr evaluation of the ARRAY_REF b[0] as part of evaluation of the lambda's by-copy capture of b (which is encoded as a VEC_INIT_EXPR<b>). Since A's constexpr default constructor is not yet defined, b's initialization is not actually constant, but because A is an empty type, evaluation of b from cxx_eval_array_ref is successful and yields an empty CONSTRUCTOR. And since this CONSTRUCTOR is empty, we {}-initialize the desired array element, and end up crashing from verify_ctor_sanity during evaluation of this initializer because we updated new_ctx.ctor without updating new_ctx.object: the former now has type A[3] and the latter is still the target of a TARGET_EXPR for b[0][0] created from cxx_eval_vec_init (and so has type A). This patch fixes this by setting new_ctx.object appropriately at the same time that we set new_ctx.ctor from cxx_eval_array_reference. gcc/cp/ChangeLog: PR c++/98295 * constexpr.c (cxx_eval_array_reference): Also set new_ctx.object when setting new_ctx.ctor. gcc/testsuite/ChangeLog: PR c++/98295 * g++.dg/cpp0x/constexpr-98295.C: New test. (cherry picked from commit 7e534fb7d8256a605b6bdc12451d209af1bed329)
next prev parent reply other threads:[~2021-02-02 5:38 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 " gscfq@t-online.de 2020-12-15 18:20 ` [Bug c++/98295] " mpolacek at gcc dot gnu.org 2020-12-15 18:26 ` [Bug c++/98295] [8/9/10/11 " mpolacek at gcc dot gnu.org 2021-01-04 15:15 ` rguenth at gcc dot gnu.org 2021-01-21 11:56 ` jakub at gcc dot gnu.org 2021-01-27 16:56 ` jakub at gcc dot gnu.org 2021-01-27 18:54 ` ppalka at gcc dot gnu.org 2021-02-01 15:29 ` cvs-commit at gcc dot gnu.org 2021-02-01 15:30 ` [Bug c++/98295] [8/9/10 " ppalka at gcc dot gnu.org 2021-02-02 5:38 ` cvs-commit at gcc dot gnu.org [this message] 2021-02-02 20:11 ` ppalka 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-98295-4-Jw5TXWcA3P@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).