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++/99705] [10 Regression] ICE in expand_expr_real_1 since r10-3661
Date: Tue, 30 Mar 2021 22:41:44 +0000	[thread overview]
Message-ID: <bug-99705-4-RlLAz6uxRm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99705-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:1c82b47137ab4212b7618da3458d2949b2dff1a3

commit r10-9623-g1c82b47137ab4212b7618da3458d2949b2dff1a3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 26 09:35:26 2021 +0100

    c++: Fix ICE with nsdmi [PR99705]

    When adding P0784R7 constexpr new support, we still didn't have
    P1331R2 implemented and so I had to change also build_vec_delete_1
    - instead of having uninitialized tbase temporary later initialized
    by MODIFY_EXPR I've set the DECL_INITIAL for it - because otherwise
    it would be rejected during constexpr evaluation which didn't like
    uninitialized vars.  Unfortunately, that change broke the following
    testcase.
    The problem is that these temporaries (not just tbase but tbase was
    the only one with an initializer) are created during NSDMI parsing
    and current_function_decl is NULL at that point.  Later when we
    clone body of constructors, auto_var_in_fn_p is false for those
    (as they have NULL DECL_CONTEXT) and so they aren't duplicated,
    and what is worse, the DECL_INITIAL isn't duplicated either nor processed,
    and during expansion we ICE because the code from DECL_INITIAL of that
    var refers to the abstract constructor's PARM_DECL (this) rather than
    the actual constructor's one.

    So, either we can just revert those build_vec_delete_1 changes (as done
    in the second patch - in attachment), or, as the first patch does, we can
    copy the temporaries during bot_manip like we copy the temporaries of
    TARGET_EXPRs.  To me that looks like a better fix because e.g. if
    break_out_of_target_exprs is called for the same NSDMI multiple times,
    sharing the temporaries looks just wrong to me.  If the temporaries
    are declared as BIND_EXPR_VARS of some BIND_EXPR (which is the case
    of the tbase variable built by build_vec_delete_1 and is the only way
    how the DECL_INITIAL can be walked by *walk_tree*), then we need to
    copy it also in the BIND_EXPR BIND_EXPR_VARS chain, other temporaries
    (those that don't need DECL_INITIAL) often have just DECL_EXPR and no
    corresponding BIND_EXPR.
    Note, ({ }) are rejected in nsdmis, so all we run into are temporaries
    the FE creates artificially.

    2021-03-26  Jakub Jelinek  <jakub@redhat.com>

            PR c++/99705
            * tree.c (bot_manip): Remap artificial automatic temporaries
mentioned
            in DECL_EXPR or in BIND_EXPR_VARS.

            * g++.dg/cpp0x/new5.C: New test.

  parent reply	other threads:[~2021-03-30 22:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22  8:49 [Bug c++/99705] New: [10/11 " jakub at gcc dot gnu.org
2021-03-22  8:50 ` [Bug c++/99705] " jakub at gcc dot gnu.org
2021-03-22 11:33 ` jakub at gcc dot gnu.org
2021-03-22 13:26 ` jakub at gcc dot gnu.org
2021-03-22 16:05 ` jakub at gcc dot gnu.org
2021-03-26  8:36 ` cvs-commit at gcc dot gnu.org
2021-03-26  8:38 ` [Bug c++/99705] [10 " jakub at gcc dot gnu.org
2021-03-30 22:41 ` cvs-commit at gcc dot gnu.org [this message]
2021-03-31  6:46 ` 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-99705-4-RlLAz6uxRm@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).