[Bug fortran/125529] ICE (segfault) in DO CONCURRENT with DEFAULT(NONE) and ASSOCIATE
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 4 23:24:21 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125529
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:
https://gcc.gnu.org/g:2851a6b21c89d80b81f9ce06cdfb943a172eca42
commit r17-1358-g2851a6b21c89d80b81f9ce06cdfb943a172eca42
Author: Jerry DeLisle <jvdelisle@gcc.gnu.org>
Date: Wed May 27 21:00:19 2026 -0700
fortran: ICE in DO CONCURRENT with DEFAULT(NONE) inside ASSOCIATE
Two bugs in check_default_none_expr caused a segfault when a DO CONCURRENT
with inline type-spec iterators (e.g. "integer :: i = 1:10") contained an
ASSOCIATE construct.
Bug 1: sym->ns->code was used to locate the ext.concur.forall_iterator
list. When a symbol's namespace is an ASSOCIATE body, sym->ns->code is an
EXEC_BLOCK node, not the DO CONCURRENT node; reading ext.concur from it
interprets the wrong union member and yields a garbage pointer. Fix: use
d->code instead, the DO CONCURRENT gfc_code node passed through the
walker's
data parameter, which is always the correct node.
Bug 2: inline type-spec iterators are shadow iterators, stored internally
with a leading underscore prepended to the name. The comparison of the
iterator's symtree name against the user-visible sym->name must skip that
underscore by advancing iter_name one character when iter->shadow is set.
PR fortran/125529
Assisted by: Claude Sonnet 4.6
gcc/fortran/ChangeLog:
PR fortran/125529
* resolve.cc (check_default_none_expr): Use d->code instead of
sym->ns->code to locate the DO CONCURRENT forall_iterator list,
avoiding a wrong-union-member read when the symbol's namespace is
an ASSOCIATE body. Skip leading underscore when comparing iterator
names for shadow iterators.
gcc/testsuite/ChangeLog:
PR fortran/125529
* gfortran.dg/do_concurrent_assoc_default_none.f90: New test.
(cherry picked from commit afe36f5576f07a5650ed8e2d9ade58d2e7e27021)
More information about the Gcc-bugs
mailing list