public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/114409] [14 Regression] ICE after adding novector pragmas (internal compiler error: in tsubst_expr, at cp/pt.cc:21794) since r14-4229-g9c62af101e11e1cce573c2b3d2e18b403412dbc8
Date: Wed, 10 Apr 2024 07:58:31 +0000	[thread overview]
Message-ID: <bug-114409-4-hH9UmqDwNg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114409-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
The question is what handles the COMPOUND_EXPR with DECL_EXPR when the
ANNOTATE_EXPR isn't around.  tsubst_expr doesn't handle DECL_EXPRs.

It's built even w/o the #pragma via finish_cond and finish_while_stmt_cond
and in that case it's tsubst_stmt that handles the COMPOUND_EXPR and
that function does handle DECL_EXPRs.  Maybe ANNOTATE_EXPR should be handled
at the "stmt" level [as well]?  Or the COMPOUND_EXPR handling in
tsubst_expr should recurse to tsubst_stmt?

That said, ( DECL_EXPR <X>, .. use of X ) is phishy?

Jason?

The following fixes it:

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index bf4b89d8413..dae423a751f 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -20635,8 +20635,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t
complain, tree in_decl)

     case COMPOUND_EXPR:
       {
-       tree op0 = tsubst_expr (TREE_OPERAND (t, 0), args,
+       tree op0 = tsubst_stmt (TREE_OPERAND (t, 0), args,
                                complain & ~tf_decltype, in_decl);
+       if (op0 == NULL_TREE)
+         /* If the first operand was a statement, we're done with it.  */
+         RETURN (RECUR (TREE_OPERAND (t, 1)));
        RETURN (build_x_compound_expr (EXPR_LOCATION (t),
                                       op0,
                                       RECUR (TREE_OPERAND (t, 1)),

  parent reply	other threads:[~2024-04-10  7:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 21:02 [Bug c++/114409] New: ICE after adding novector pragmas (internal compiler error: in tsubst_expr, at cp/pt.cc:21794) sjames at gcc dot gnu.org
2024-03-20 21:05 ` [Bug c++/114409] " sjames at gcc dot gnu.org
2024-03-20 21:16 ` pinskia at gcc dot gnu.org
2024-03-20 21:21 ` pinskia at gcc dot gnu.org
2024-03-20 21:26 ` pinskia at gcc dot gnu.org
2024-03-20 21:29 ` sjames at gcc dot gnu.org
2024-03-21  9:37 ` rguenth at gcc dot gnu.org
2024-03-21 13:17 ` jakub at gcc dot gnu.org
2024-03-21 13:26 ` jakub at gcc dot gnu.org
2024-03-21 13:41 ` [Bug c++/114409] [14 Regression] " jakub at gcc dot gnu.org
2024-03-21 13:53 ` jakub at gcc dot gnu.org
2024-03-21 14:31 ` jakub at gcc dot gnu.org
2024-03-21 20:39 ` pinskia at gcc dot gnu.org
2024-04-10  7:58 ` rguenth at gcc dot gnu.org [this message]
2024-04-10 12:40 ` [Bug c++/114409] [14 Regression] ICE after adding novector pragmas (internal compiler error: in tsubst_expr, at cp/pt.cc:21794) since r14-4229-g9c62af101e11e1cce573c2b3d2e18b403412dbc8 jakub at gcc dot gnu.org
2024-04-10 12:49 ` jakub at gcc dot gnu.org
2024-04-10 12:50 ` jakub at gcc dot gnu.org
2024-04-11  7:48 ` cvs-commit at gcc dot gnu.org
2024-04-11 10:10 ` jakub at gcc dot gnu.org
2024-04-11 10:11 ` 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-114409-4-hH9UmqDwNg@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).