https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108459
Bug ID: 108459 Summary: [OpenMP] ICE during GIMPLE pass: ompexp (segfault) in expand_omp_for_init_counts Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: ice-on-valid-code, openmp Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- The following innocent looking code gives an ICE. As probably visible from the look of the code, it was found via Fortran code, related to patch work for PR fortran/107424. This affects all versions down to GCC 11, which is the first one to support non-rectangular loop nests. Compiling the C test below with '-fopenmp' gives: during GIMPLE pass: ompexp ff.c: In function ‘s1’: ff.c:12:13: internal compiler error: Segmentation fault 12 | #pragma omp for collapse(2) | ^~~ 0xef701f crash_signal ../../repos/gcc-trunk-commit/gcc/toplev.cc:314 0x7f9f608ce51f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0xbc5560 is_gimple_val(tree_node*) ../../repos/gcc-trunk-commit/gcc/gimple-expr.cc:837 0xc368f3 force_gimple_operand_1(tree_node*, gimple**, bool (*)(tree_node*), tree_node*) ../../repos/gcc-trunk-commit/gcc/gimplify-me.cc:55 0xc36b0f force_gimple_operand_gsi_1(gimple_stmt_iterator*, tree_node*, bool (*)(tree_node*), tree_node*, bool, gsi_iterator_update) ../../repos/gcc-trunk-commit/gcc/gimplify-me.cc:115 0xc36b0f force_gimple_operand_gsi(gimple_stmt_iterator*, tree_node*, bool, tree_node*, bool, gsi_iterator_update) ../../repos/gcc-trunk-commit/gcc/gimplify-me.cc:141 0x1de8b5e expand_omp_for_init_counts ../../repos/gcc-trunk-commit/gcc/omp-expand.cc:2011 void s1 (int *a1, int *a2) { int i; int j; { int D4266; int D4267; D4266 = -*a1; D4267 = *a2; #pragma omp for collapse(2) for (i = 1; i <= 16; i = i + 1) for (j = i * D4266 + D4267; j <= 16; j = j + 1) { } } }