From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3FA9A3882018; Tue, 2 May 2023 20:15:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FA9A3882018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683058554; bh=Oc/0/bseBdSilQhfDF2evk2pVpVORHiGDRuZz/jg/GA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=vLy+oeJlFQUZ+6BnNyy29fkltIGJ1Ngq68AoZdBkzyuq1r4K1QI5Qe7dRbajx18nX NdxBqte4rlzMdEeSy/1s0BniylqKC+++v7roDWRpbSrNdt8VIB6yAV7G9kQjOvTJGb ywzqlai+a9R1yjIVqWrPaUm2Y2sFi7EDv6jMjfhI= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108685] [10/11 Regression] ICE in verify_loop_structure, at cfgloop.cc:1748 since r13-2388-ga651e6d59188da Date: Tue, 02 May 2023 20:15:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-checking, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 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=3D108685 --- Comment #11 from CVS Commits --- The releases/gcc-11 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:38812e9e87c4d42f1d9916788c92f17273d772dc commit r11-10725-g38812e9e87c4d42f1d9916788c92f17273d772dc Author: Jakub Jelinek Date: Fri Mar 17 08:46:28 2023 +0100 openmp: Fix up handling of doacross loops with noreturn body in loops [PR108685] The following patch fixes an ICE with doacross loops which have a single entry no exit body, at least one of the ordered > collapse loops isn't guaran= teed to have at least one iteration and the whole doacross loop is inside some other loop. The OpenMP constructs aren't represented by struct loop until the omp expansions, so for a normal doacross loop which doesn't have a noreturn body the entry_bb with the GOMP_FOR statement and the first bb of the body typically have= the same loop_father, and if the doacross loop isn't inside of some other l= oop and the body is noreturn as well, both are part of loop 0. The problem= atic case is when the entry_bb is inside of some deeper loop, but the body, because it falls through into EXIT, has loop 0 as loop_father. l0_bb is create= d by splitting the entry_bb fallthru edge into l1_bb, and because the two ba= sic blocks have different loop_father, a common loop is found for those (which is = loop 0). Now, if the doacross loop has collapse =3D=3D ordered or all the ordere= d > collapse loops are guaranteed to iterate at least once, all is still fine, becau= se all enter the l1_bb (body), which doesn't return and so doesn't loop further either. But, if one of those loops could loop 0 times, the user written body wouldn't be reached at all, so unlike the expectations the whole construct actually wouldn't be noreturn if entry_bb is encountered and decides to handle at least o= ne iteration. In this case, we need to fix up, move the l0_bb into the same loop as entry_bb (initially) and for the extra added loops put them as children of that = same loop, rather than of loop 0. 2023-03-17 Jakub Jelinek PR middle-end/108685 * omp-expand.c (expand_omp_for_ordered_loops): Add L0_BB argume= nt, use its loop_father rather than BODY_BB's loop_father. (expand_omp_for_generic): Adjust expand_omp_for_ordered_loops caller. If broken_loop with ordered > collapse and at least one of those extra loops aren't guaranteed to have at least one iteration, change l0_bb's loop_father to entry_bb's loop_father. Set cont_bb's loop_father to l0_bb's loop_father rather than l1_bb's. * c-c++-common/gomp/doacross-8.c: New test. (cherry picked from commit 713fa5db8ceb4ba8783a0d690ceb4c07f2ff03d0)=