[all-commits] [llvm/llvm-project] 32eae3: [flang] Statement function dummy names do not clas...
Eugene Epshteyn via All-commits
all-commits at lists.llvm.org
Wed Jul 29 10:21:38 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 32eae3a39471911888ba50bf03379450b4d96e3e
https://github.com/llvm/llvm-project/commit/32eae3a39471911888ba50bf03379450b4d96e3e
Author: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M flang/lib/Semantics/resolve-names.cpp
M flang/test/Semantics/stmt-func04.f90
Log Message:
-----------
[flang] Statement function dummy names do not clash with host or unreferenced global names (#212396)
The check added for F2023 19.4 p2 (statement function dummy argument
name may be the same as an accessible name only if that name is a scalar
variable) looked the name up through the whole host scope chain and,
failing that, in the global scope. Both lookups overshoot what is
"accessible" in the scoping unit:
* Per F2023 19.5.1.4 p2 item (11), the appearance of a name as a
dummy-arg-name in a stmt-function-stmt makes any host entity of that
name inaccessible by host association throughout the scoping unit, so a
host entity can never conflict with the dummy.
* A global entity to which the scoping unit makes no reference at all is
not accessible in it; otherwise conformance would depend on whether
unrelated program units happen to be compiled in the same file.
This caused bogus errors on conforming code such as
```
program p
logical, external :: x
contains
subroutine s
real :: f
f(x) = x * x ! 'x' is an implicitly typed real dummy here
end
end
```
where the dummy 'x' must be implicitly typed real (both NAG and gfortran
accept this and type it that way; flang already typed it correctly, but
rejected the program).
Restrict the lookup to names made visible by the scoping unit itself
(declared, referenced, or USE-associated there), matching the lookup
HandleStmtFunction already uses to type the dummies.
Assisted-by: AI
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list