[Bug fortran/102459] [13/14/15/16 Regression] ICE in gfc_conv_scalarized_array_ref, at fortran/trans-array.c:3549 since r12-1108-g9a5de4d5af1c10a8
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Mar 29 21:04:11 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102459
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Paul Thomas <pault@gcc.gnu.org>:
https://gcc.gnu.org/g:356ae4e80d16207ec608150ec9fb726427d2dbd4
commit r13-10231-g356ae4e80d16207ec608150ec9fb726427d2dbd4
Author: Christopher Albert <albert@tugraz.at>
Date: Tue Mar 10 18:46:54 2026 +0100
fortran: Fix OpenMP iterator depend lowering for component arrays
[PR102459]
When lowering an OpenMP depend clause with an iterator expression such as
x(j)%a, the front end currently looks only at the first REF_ARRAY to
decide between scalar-reference lowering and array-descriptor lowering.
For x(j)%a that first ref is the scalar base element x(j), but the full
expression is still the rank-1 component array a.
As a result, the code calls gfc_conv_expr_reference on an array-valued
expression, which later reaches gfc_conv_scalarized_array_ref without a
scalarizer state and ICEs.
Fix this by choosing the lowering path from the rank of the full
expression. Rank-zero expressions still use gfc_conv_expr_reference,
while array-valued expressions are lowered through
gfc_conv_expr_descriptor.
Apply the same adjustment to the analogous depobj helper and add a
regression test for task depend clauses covering both x(j)%a and the
scalar control case x(j)%a(1).
gcc/fortran/ChangeLog:
PR fortran/102459
* trans-openmp.cc (gfc_trans_omp_clauses): Choose the scalar
reference path from the full expression rank rather than the first
array reference.
(gfc_trans_omp_depobj): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/102459
* gfortran.dg/pr102459.f90: New test.
Signed-off-by: Christopher Albert <albert@tugraz.at>
(cherry picked from commit d2ab04fbba7b97d17e4f9e0885d71a4e1faafc96)
More information about the Gcc-bugs
mailing list