https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109552
Bug ID: 109552 Summary: ICE with "cancel" directive in "taskloop" construct Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: frederik at gcc dot gnu.org Target Milestone: --- Created attachment 54882 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54882&action=edit C version of the test The following Fortran code produces an ICE in the middle-end when I compile it as a libgomp test (i.e. with -fopenmp; same error at different optimization levels): program test integer :: a integer :: i !$omp parallel !$omp taskloop do i = 1,10 !$omp cancel taskgroup if (a .eq. 1) call abort () end do !$omp end taskloop !$omp end parallel end program Error: FAIL: libgomp.fortran/cancel-taskloop.f90 -O (test for excess errors) Excess errors: during GIMPLE pass: ompexp ../../../../libgomp/testsuite/libgomp.fortran/cancel-taskloop.f90:6:16: internal compiler error: in verify_sese, at tree-cfg.cc:7654 0x7c0878 verify_sese(basic_block_def*, basic_block_def*, vec<basic_block_def*, va_heap, vl_ptr>*) ../../gcc/tree-cfg.cc:7654 0x14d4958 move_sese_region_to_fn(function*, basic_block_def*, basic_block_def*, tree_node*) ../../gcc/tree-cfg.cc:7770 0x2606968 expand_omp_taskreg ../../gcc/omp-expand.cc:1444 0x260ca3f expand_omp_synch ../../gcc/omp-expand.cc:8659 0x260ca3f expand_omp ../../gcc/omp-expand.cc:10616 0x260c77c expand_omp ../../gcc/omp-expand.cc:10565 0x260c77c expand_omp ../../gcc/omp-expand.cc:10565 0x260e9fa execute_expand_omp ../../gcc/omp-expand.cc:10819 A canonical conversion of the test to C/C++ leads to the same error from gcc/g++. I am not sure if the code is valid according to the OpenMP spec, but the ICE is certainly wrong. The GCC build has been configured with "--enable-languages=fortran,c,c++ --enable-checking=all --disable-multilib --disable-bootstrap" and the version is "gcc version 14.0.0 20230419 (experimental) (GCC)".