https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128566
--- Comment #4 from Harald Anlauf <anlauf at gcc dot gnu.org> --- I accidentally mixed up the PR in the commit message so that it went to pr128656#c1. Sorry for that! The master branch has been updated by Harald Anlauf <[email protected]>: https://gcc.gnu.org/g:b154458ecbbe6b8242a2eec9e717bc5237badb16 commit r17-6187-gb154458ecbbe6b8242a2eec9e717bc5237badb16 Author: Harald Anlauf <[email protected]> Date: Wed Nov 11 22:38:19 2026 +0100 fortran: ALLOCATE with STATUS and overflow of array size [PR128656] For ALLOCATE with STATUS present, ensure that status is set to the "already allocated error" for an allocatable array only if it is already allocated, even if the size calculation would overflow or exceed virtual memory. For pointer arrays, only the virtual memory exceeded error can occur. PR fortran/128656 gcc/fortran/ChangeLog: * trans-array.cc (gfc_array_allocate): Push logic handling error status to gfc_allocate_allocatable for allocatable arrays. * trans.cc (gfc_allocate_allocatable): Implement the logic here. * trans.h (gfc_allocate_allocatable): Adjust prototype. gcc/testsuite/ChangeLog: * gfortran.dg/allocate_alloc_opt_16.f90: New test.
