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++/114409] [14 Regression] ICE after adding novector pragmas (internal compiler error: in tsubst_expr, at cp/pt.cc:21794) since r14-4229-g9c62af101e11e1cce573c2b3d2e18b403412dbc8 Date: Thu, 11 Apr 2024 07:48:19 +0000 [thread overview] Message-ID: <bug-114409-4-SkOxw3pZW4@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 #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:cb46aca0a07355abf2f0b04f52087bca8f848524 commit r14-9910-gcb46aca0a07355abf2f0b04f52087bca8f848524 Author: Jakub Jelinek <jakub@redhat.com> Date: Thu Apr 11 09:46:00 2024 +0200 c++: Fix ANNOTATE_EXPR instantiation [PR114409] The following testcase ICEs starting with the r14-4229 PR111529 change which moved ANNOTATE_EXPR handling from tsubst_expr to tsubst_copy_and_build. ANNOTATE_EXPR is only allowed in the IL to wrap a loop condition, and the loop condition of while/for loops can be a COMPOUND_EXPR with DECL_EXPR in the first operand and the corresponding VAR_DECL in the second, as created by finish_cond else if (!empty_expr_stmt_p (cond)) expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), cond, expr); Since then Patrick reworked the instantiation, so that we have now tsubst_stmt and tsubst_expr and ANNOTATE_EXPR ended up in the latter, while only tsubst_stmt can handle DECL_EXPR. Now, the reason why the while/for loops with variable declaration in the condition works in templates without the pragmas (i.e. without ANNOTATE_EXPR) is that both the FOR_STMT and WHILE_STMT handling uses RECUR aka tsubst_stmt in handling of the *_COND operand: case FOR_STMT: stmt = begin_for_stmt (NULL_TREE, NULL_TREE); RECUR (FOR_INIT_STMT (t)); finish_init_stmt (stmt); tmp = RECUR (FOR_COND (t)); finish_for_cond (tmp, stmt, false, 0, false); and case WHILE_STMT: stmt = begin_while_stmt (); tmp = RECUR (WHILE_COND (t)); finish_while_stmt_cond (tmp, stmt, false, 0, false); Therefore, it will handle DECL_EXPR embedded in COMPOUND_EXPR of the {WHILE,FOR}_COND just fine. But if that COMPOUND_EXPR with DECL_EXPR is wrapped with one or more ANNOTATE_EXPRs, because ANNOTATE_EXPR is now done solely in tsubst_expr and uses RECUR there (i.e. tsubst_expr), it will ICE on DECL_EXPR in there. This could be fixed by keeping ANNOTATE_EXPR handling in tsubst_expr but using tsubst_stmt for the first operand, but this patch instead moves ANNOTATE_EXPR handling to tsubst_stmt (and uses tsubst_expr for the second/third operand). 2024-04-11 Jakub Jelinek <jakub@redhat.com> PR c++/114409 * pt.cc (tsubst_expr) <case ANNOTATE_EXPR>: Move to ... (tsubst_stmt) <case ANNOTATE_EXPR>: ... here. Use tsubst_expr instead of RECUR for the last 2 arguments. * g++.dg/ext/pr114409-2.C: New test.
next prev parent reply other threads:[~2024-04-11 7:48 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 ` [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 rguenth at gcc dot gnu.org 2024-04-10 12:40 ` 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 [this message] 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-SkOxw3pZW4@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).