https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93554

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <[email protected]>:

https://gcc.gnu.org/g:010618b8dcb73220790f8f82cf76e8a2aacc2122

commit r16-8571-g010618b8dcb73220790f8f82cf76e8a2aacc2122
Author: Christopher Albert <[email protected]>
Date:   Fri Apr 3 18:37:54 2026 +0200

    fortran: Fix ICE in expand_oacc_for with private derived type [PR93554]

    Using a derived type with an allocatable component in a private clause
    on an OpenACC loop caused an ICE in expand_oacc_for because the
    finalization code for the allocatable component inserted additional
    basic blocks between the loop's continuation/entry blocks and the exit
    block, violating the strict CFG assertions.

    The assertions checked that BRANCH_EDGE(entry_bb)->dest == exit_bb and
    FALLTHRU_EDGE(cont_bb)->dest == exit_bb, but with finalization blocks
    these edges can point to intermediate blocks rather than directly to
    the exit.  Relax the assertions to only verify the expected edge count
    (two successors) without requiring specific destinations.

            PR fortran/93554

    gcc/ChangeLog:

            * omp-expand.cc (expand_oacc_for): Relax entry_bb and cont_bb
            assertions to allow intermediate blocks from finalization code.
            Remove exit_bb predecessor count assertion.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/goacc/pr93554.f90: New test.

    Signed-off-by: Christopher Albert <[email protected]>

Reply via email to