[Bug fortran/93715] [13/14/15 Regression] ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:6320

2026-05-13 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93715

Paul Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #15 from Paul Thomas  ---
Pushed to all active branches after regression testing on each.

Closing as fixed.

Paul

[Bug fortran/93715] [13/14/15 Regression] ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:6320

2026-05-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93715

--- Comment #14 from GCC Commits  ---
The releases/gcc-13 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:c5ddbb5342e2926ccda04c084bb20e458cef9232

commit r13-10304-gc5ddbb5342e2926ccda04c084bb20e458cef9232
Author: Christopher Albert 
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  

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 
(cherry picked from commit 2b0a29a94c9946e32cf76f4f65da368b4f005566)

[Bug fortran/93715] [13/14/15 Regression] ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:6320

2026-05-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93715

--- Comment #13 from GCC Commits  ---
The releases/gcc-14 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:1f571e84232e1fbc61e77755bb5aac107fa4ce95

commit r14-12582-g1f571e84232e1fbc61e77755bb5aac107fa4ce95
Author: Christopher Albert 
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  

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 
(cherry picked from commit 2b0a29a94c9946e32cf76f4f65da368b4f005566)

[Bug fortran/93715] [13/14/15 Regression] ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:6320

2026-05-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93715

--- Comment #12 from GCC Commits  ---
The releases/gcc-15 branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:f2e6f09d789a5fc41697a3c3a2633b5db4fac49d

commit r15-11150-gf2e6f09d789a5fc41697a3c3a2633b5db4fac49d
Author: Christopher Albert 
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  

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 
(cherry picked from commit 2b0a29a94c9946e32cf76f4f65da368b4f005566)

[Bug fortran/93715] [13/14/15 Regression] ICE in gfc_trans_auto_array_allocation, at fortran/trans-array.c:6320

2026-04-08 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93715

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
Summary|[13/14/15/16 Regression]|[13/14/15 Regression] ICE
   |ICE in  |in
   |gfc_trans_auto_array_alloca |gfc_trans_auto_array_alloca
   |tion, at|tion, at
   |fortran/trans-array.c:6320  |fortran/trans-array.c:6320

--- Comment #11 from Paul Thomas  ---
That's 16 done - removing from the summary.

Paul