[PATCH] PR125532 wrong-code in DO CONCURRENT with ASSOCIATE

Jerry D jvdelisle2@gmail.com
Fri Jun 5 19:32:06 GMT 2026


See attached patch.

This fix is also straight forward.

Regression tested on x86_64.

OK for mainline and later backport to 16.

Reagrds,

Jerry

---

When an ASSOCIATE body references inline type-spec iterator,
replace_in_code_recursive lacked a case for EXEC_BLOCK
(associate constructs).  So, it silently skipped both
the ASSOCIATE selector expressions and the body when
replacing shadow iterator references.

Add case EXEC_BLOCK to iterate over each selector's target
expression via replace_in_expr_recursive and recurse into
the body namespace's code list via replace_in_code_recursive.

PR fortran/125532

Assisted by: Claude Sonnet 4.6

gcc/fortran/ChangeLog:

	* resolve.cc (replace_in_code_recursive): Add EXEC_BLOCK case to
	replace shadow iterator references in ASSOCIATE selector expressions
	and the ASSOCIATE body namespace.

gcc/testsuite/ChangeLog:

	* gfortran.dg/do_concurrent_assoc_iter_1.f90: New test.
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PR125532-do-concurrent-assoc-iter.patch
Type: text/x-patch
Size: 3289 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20260605/f62ed6ee/attachment.bin>


More information about the Fortran mailing list