From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1AB9338555A0; Fri, 17 Mar 2023 08:00:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AB9338555A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679040009; bh=zX7TcrJaT+f3iV81NGAhIEVYq0f1r2F/gTKzAe1ytqk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=L81EpOi3nrkTCDGYnyP2TxvqlEXZvDREoK6HbcoCKUTcSd2x+L7DcZAhISIYhotn6 AKYrkPlM+3y+S/Sz/0CSrPdeC1lWjDquXN+PV1N6kOgZr/61FalovrWYbYYGN+s5Jx EiO60PBDWRNwkknBkd+lQGslC7D0oIcPlnjzI6Vo= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108685] [10/11/12/13 Regression] ICE in verify_loop_structure, at cfgloop.cc:1748 since r13-2388-ga651e6d59188da Date: Fri, 17 Mar 2023 08:00:08 +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 #7 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:713fa5db8ceb4ba8783a0d690ceb4c07f2ff03d0 commit r13-6731-g713fa5db8ceb4ba8783a0d690ceb4c07f2ff03d0 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.cc (expand_omp_for_ordered_loops): Add L0_BB argum= ent, 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.=