fortran: Fix DO CONCURRENT nested-in-block iterator counting [PR123943]
Fix iterator-depth pre-counting in gfc_resolve_forall for nested
DO CONCURRENT/FORALL constructs inside block arms (e.g. IF/ELSE,
SELECT CASE). The previous logic only scanned a flat next-chain,
which could undercount and trigger an ICE assertion.
Add a regression test based on a reduced testcase from Harald Anlauf.
Adjust wording in one comment to avoid GNU-style checker complaints.
PR fortran/123943
gcc/fortran/ChangeLog:
* resolve.cc (gfc_max_forall_iterators_in_chain): New helper
function for factorization of iterator-depth counting.
(gfc_count_forall_iterators): Use it.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr123943.f90: New test.
Co-authored-by: Harald Anlauf <anlauf@gcc.gnu.org> Signed-off-by: Christopher Albert <albert@tugraz.at>