From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 71154384AB7A; Thu, 11 Apr 2024 07:48:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71154384AB7A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712821700; bh=YMew/61FDEPoT3YaFwwX+NT1IsTAOV2VdvaHWZsRxkw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qZr7TQzjjyig8FmIsSaWo7ghk2V8SDhNzzyj5Rtc728VINQFzhLSrZ18O8g3CSwAh TIDU4nMQy/RZzQhuRwPRZBcW7PXtr3Tuzws8wXikOzbhW46HI9bhnw1spcbmPwyGHl 7FWyC0Bm7N5Sf+3XKz7D2iFOuM33BGlX7gAKilnw= From: "cvs-commit at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114409 --- Comment #17 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:cb46aca0a07355abf2f0b04f52087bca8f848524 commit r14-9910-gcb46aca0a07355abf2f0b04f52087bca8f848524 Author: Jakub Jelinek 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 =3D 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 =3D begin_for_stmt (NULL_TREE, NULL_TREE); RECUR (FOR_INIT_STMT (t)); finish_init_stmt (stmt); tmp =3D RECUR (FOR_COND (t)); finish_for_cond (tmp, stmt, false, 0, false); and case WHILE_STMT: stmt =3D begin_while_stmt (); tmp =3D 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 th= ere. 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 t= he second/third operand). 2024-04-11 Jakub Jelinek PR c++/114409 * pt.cc (tsubst_expr) : Move to ... (tsubst_stmt) : ... here. Use tsubst_expr instead of RECUR for the last 2 arguments. * g++.dg/ext/pr114409-2.C: New test.=