From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 80022385843A; Fri, 24 Nov 2023 07:54:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80022385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700812458; bh=BCpLN5x2yHFqTBsZNWwQuiscSnSSIyjfv681X+GWPIE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sUCQkhn1LFDf/1I4By4qfDkVZN7KOZ/sxA9Et10RfkiOKFk/lrLAymJoiNP/ITleu fgYr3xKu8ibHPenelg267k+qALSWYnR2KP77izA0AnM2d9eNkmCLtpSrFlMRROq/Kt eb3iVBjH6zyD7tMOgFOUc6nyxS/pftvUQWevKK9c= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112619] [14 regression] ICE when building libcrafter (tree check: expected statement_list, have modify_expr in tsi_start, at tree-iterator.h:57) since r14-5086-gae07265381d934 Date: Fri, 24 Nov 2023 07:54:17 +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: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned 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=3D112619 --- Comment #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:1c44bd92a86db3fcdeb4a66ce2f3222d13af0681 commit r14-5814-g1c44bd92a86db3fcdeb4a66ce2f3222d13af0681 Author: Jakub Jelinek Date: Fri Nov 24 08:44:28 2023 +0100 tree: Fix up try_catch_may_fallthru [PR112619] The following testcase ICEs with -std=3Dc++98 since r14-5086 because block_may_fallthru is called on a TRY_CATCH_EXPR whose second operand is a MODIFY_EXPR rather than STATEMENT_LIST, which try_catch_may_fallth= ru apparently expects. I've been wondering whether that isn't some kind of FE bug and whether there isn't some unwritten rule that second operand of TRY_CATCH_EXPR must be a STATEMENT_LIST. Looking at the FEs, the C++ FE uses mostly i= ts own trees, TRY_BLOCK (TRY_CATCH_EXPR replacement) with HANDLER in it (CATCH_EXPR replacement) - but HANDLER can be immediate second operand rather than nested in STATEMENT_LIST, EH_SPEC_BLOCK (this one stands for both TRY_CATCH_EX= PR and EH_FILTER_EXPR in its second argument); both of these are only repl= aced by the generic trees during gimplification though, so will unlikely be = seen by block_may_fallthru; and then CLEANUP_STMT, which is genericized into TRY_CATCH_EXPR with non-CATCH_EXPR/EH_FILTER_EXPR in its body (thi= s is the one that causes the ICE on this testcase). The Go and Rust FEs create TRY_CATCH_EXPR with CATCH_EXPR immediately in its second argument (but either are unlucky that block_may_fallthru isn't called or the body can always fallthru, or latent ICE), while the D FE most li= kely hit this ICE and attempts to work around it, by checking at TRY_CATCH_E= XPR creation time if the second argument from pop_stmt_list is STATEMENT_LI= ST and if not, forcefully wraps it into a STATEMENT_LIST. Unfortunately, I don't see an easy way to create an artificial tree iterator from just a single tree statement, so the patch duplicates what the loo= ps later do (after all, it is very simple, just didn't want to duplicate also the large comments explaning it, so the 3 See below. comments). 2023-11-24 Jakub Jelinek PR c++/112619 * tree.cc (try_catch_may_fallthru): If second operand of TRY_CATCH_EXPR is not a STATEMENT_LIST, handle it as if it was a STATEMENT_LIST containing a single statement. * g++.dg/eh/pr112619.C: New test.=