https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93715
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Paul Thomas <[email protected]>: https://gcc.gnu.org/g:1f571e84232e1fbc61e77755bb5aac107fa4ce95 commit r14-12582-g1f571e84232e1fbc61e77755bb5aac107fa4ce95 Author: Christopher Albert <[email protected]> Date: Sun Mar 29 20:52:26 2026 +0200 fortran: Fix ICE in gfc_trans_auto_array_allocation with scalar coarray [PR93715] A scalar coarray variable (e.g. integer :: b[*]) used in asynchronous I/O causes an ICE in gfc_trans_auto_array_allocation because the variable reaches gfc_trans_auto_array_allocation which asserts GFC_ARRAY_TYPE_P on the backend declaration type. For scalar coarrays, the backend type is a plain scalar, not a GFC array type. The root cause is in gfc_trans_deferred_vars: scalar coarray variables enter the AS_EXPLICIT case because sym->attr.codimension is set and the coarray spec type is AS_EXPLICIT. The existing guard for static coarray variables does not catch non-static scalar coarrays, so they fall through to gfc_trans_auto_array_allocation. Add a check for scalar coarrays (codimension without dimension) to skip array allocation, since these variables have no array rank and do not need auto array allocation. 2026-04-08 Paul Thomas <[email protected]> PR fortran/93715 gcc/fortran * trans-decl.cc (gfc_trans_deferred_vars): Skip auto array allocation for scalar coarrays. gcc/testsuite * gfortran.dg/pr93715.f90: New test. Signed-off-by: Christopher Albert <[email protected]> (cherry picked from commit 2b0a29a94c9946e32cf76f4f65da368b4f005566)
