From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CF5953858401; Sun, 3 Apr 2022 10:28:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF5953858401 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103328] [11/12 Regression] ICE in remap_gimple_stmt with coroutines since r11-7419-g0f161cc8494cf728 Date: Sun, 03 Apr 2022 10:28:37 +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: 11.2.1 X-Bugzilla-Keywords: ice-on-valid-code, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2022 10:28:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103328 --- Comment #23 from CVS Commits --- The master branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:0847ad33b908af88bca1e6980d0b977316d05e18 commit r12-7971-g0847ad33b908af88bca1e6980d0b977316d05e18 Author: Benno Evers Date: Sat Apr 2 17:22:33 2022 +0100 c++: Fix ICE due to shared BLOCK node in coroutine generation [PR103328] When finishing a function that is a coroutine, the function is transformed into a "ramp" function, and the original user-provided function body gets moved into a newly created "actor" function. In this case `current_function_decl` points to the ramp function, but `current_binding_level->blocks` would still point to the scope block of the user-provided function body in the actor function, so when the ramp function was finished during `poplevel()` in decl.cc, we could end up with that block being reused as the `DECL_INITIAL()` of the ramp function: subblocks =3D functionbody >=3D 0 ? current_binding_level->blocks : = 0; // [...] DECL_INITIAL (current_function_decl) =3D block ? block : subblocks; This block would then be independently modified by subsequent passes touching either the ramp or the actor function, potentially causing an ICE depending on the order and function of these passes. gcc/cp/ChangeLog: PR c++/103328 * coroutines.cc (morph_fn_to_coro): Reset current_binding_level->blocks. gcc/testsuite/ChangeLog: PR c++/103328 * g++.dg/coroutines/pr103328.C: New test. Co-Authored-By: Iain Sandoe =