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++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790
Date: Tue, 11 Oct 2022 17:52:24 +0000	[thread overview]
Message-ID: <bug-106925-4-Xoy5D08raU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106925-4@http.gcc.gnu.org/bugzilla/>

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

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

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think the problem is that since r12-8066, in cxx_eval_vec_init we perform
expand_vec_init_expr while processing the default argument, at which point
start_preparsed_function hasn't yet set current_function_decl. 
expand_vec_init_expr then leads to maybe_splice_retval_cleanup which checks
DECL_CONSTRUCTOR_P (current_function_decl) without checking that
current_function_decl is non-null first.  It seems correct that
current_function_decl is null at that point, so the fix should be just:

--- a/gcc/cp/except.cc
+++ b/gcc/cp/except.cc
@@ -1327,6 +1327,7 @@ maybe_splice_retval_cleanup (tree compound_stmt)
        && current_binding_level->level_chain->kind == sk_function_parms);

   if ((function_body || current_binding_level->kind == sk_try)
+      && current_function_decl
       && !DECL_CONSTRUCTOR_P (current_function_decl)
       && !DECL_DESTRUCTOR_P (current_function_decl)
       && current_retval_sentinel)

  parent reply	other threads:[~2022-10-11 17:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 11:58 [Bug c++/106925] New: internal compiler error: Segmentation fault carlosgalvezp at gmail dot com
2022-09-13 14:17 ` [Bug c++/106925] [12/13 Regression] ICE in maybe_splice_retval_cleanup at gcc/cp/except.cc:1330 since r12-8066-g4822108e61ab8790 marxin at gcc dot gnu.org
2022-10-10  6:31 ` carlosgalvezp at gmail dot com
2022-10-11 17:52 ` mpolacek at gcc dot gnu.org [this message]
2022-10-11 18:21 ` mpolacek at gcc dot gnu.org
2022-10-13 15:06 ` cvs-commit at gcc dot gnu.org
2022-10-13 15:09 ` cvs-commit at gcc dot gnu.org
2022-10-13 15:10 ` mpolacek at gcc dot gnu.org
2022-10-14  6:18 ` carlosgalvezp at gmail dot com

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-106925-4-Xoy5D08raU@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).