Re: [PATCH] PR125532 wrong-code in DO CONCURRENT with ASSOCIATE
Jerry D <[email protected]>
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:d84a302d4f0a440aa602f9688d339532a21c81a1 commit r17-1395-gd84a302d4f0a440aa602f9688d339532a21c81a1 Author: Jerry DeLisle <[email protected]> Date: Sat Jun 6 10:06:17 2026 -0700 On 6/5/26 11:32 PM, Paul Richard Thomas wrote: > Hi Jerry, > > That is a cunning patch! I suggest that the comment before > replace_in_expr_recursive be updated to reflect this new usage? eg.: > > /* Given a FORALL or DO CONCURRENT, containing associate blocks, constructs. > 1) Resolve the iterators. > 2) Check for shadow index-name(s) and update code block. > 3) call gfc_resolve_forall_body to resolve the body. */ > > /* Custom recursive expression walker that replaces symbols. > This ensures we visit ALL expressions including those in array > subscripts. */ > > OK for mainline and backporting. > > Thanks for the patch. > > Paul > > On Fri, 5 Jun 2026 at 20:32, Jerry D <[email protected]> wrote: >> >> 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. >> ---