From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9687439C0C03; Fri, 5 Mar 2021 20:59:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9687439C0C03 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/99322] [11 Regression] ICE in change_scope, at final.c:1480 Date: Fri, 05 Mar 2021 20:59:33 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.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 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: Fri, 05 Mar 2021 20:59:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99322 --- Comment #5 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a3ad6489d38982434faef3bc5f33e3c28c5f7c74 commit r11-7533-ga3ad6489d38982434faef3bc5f33e3c28c5f7c74 Author: Jakub Jelinek Date: Fri Mar 5 21:52:35 2021 +0100 openmp: Avoid ICEs due to orphaned labels in OpenMP regions [PR99322] When performing cfg cleanup at the end of cfg pass, if there are any Op= enMP regions and some basic blocks are unreachable and contain forced labels, remove_bb moves the labels to previous bb, but if the two bb belong to different OpenMP regions, that means it will end up in a different function from where it was assumed to be and checked e.g. during gimplification or OpenMP region SESE checking. The following patch will place the labels to some bb from the right Ope= nMP region if the previous bb is not that. I think it should happen very rarely, normally the bbs from each OpenMP region should be from the before-cfg = pass adjacent and the problems will usually be only if the OpenMP regions are no-return, so I hope it isn't fatal that it searches through all bbs on= the miss. If it turns out to be a problem, it can always lazily create some better data structure and maintain it through bb removals when it reaches that case= the first time. 2021-03-05 Jakub Jelinek PR middle-end/99322 * tree-cfg.c (bb_to_omp_idx): New variable. (execute_build_cfg): Release the bb_to_omp_idx vector after cleanup_tree_cfg returns. (handle_abnormal_edges): Remove bb_to_omp_idx argument, adjust for bb_to_omp_idx being a vec instead of pointer to array of ints. (make_edges): Remove bb_to_omp_idx local variable, don't pass it to handle_abnormal_edges, adjust for bb_to_omp_idx being a vec instead of pointer to array of ints and don't free/rel= ease it at the end. (remove_bb): When removing a bb and placing forced label somewh= ere else, ensure it is put into the same OpenMP region during cfg pass if possible or to entry successor as fallback. Unregister bb from bb_to_omp_idx. * c-c++-common/gomp/pr99322.c: New test.=