[all-commits] [llvm/llvm-project] 350a72: [flang][OpenMP] Implicit declarations of procedure...
Krzysztof Parzyszek via All-commits
all-commits at lists.llvm.org
Fri Jun 5 13:33:30 PDT 2026
Branch: refs/heads/users/kparzysz/resolve-declare-target
Home: https://github.com/llvm/llvm-project
Commit: 350a72b4b38ee72ab11f9c60e19d4a696dddbc33
https://github.com/llvm/llvm-project/commit/350a72b4b38ee72ab11f9c60e19d4a696dddbc33
Author: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: 2026-06-05 (Fri, 05 Jun 2026)
Changed paths:
M flang/lib/Semantics/resolve-names.cpp
A flang/test/Semantics/OpenMP/declare-target-symbols.f90
M flang/test/Semantics/OpenMP/declare-target08.f90
Log Message:
-----------
[flang][OpenMP] Implicit declarations of procedures in DECLARE_TARGET
This replaces commit 8f5df8891840b, since it was rejecting the following
case:
```
function baz(a)
!$omp declare target to(baz)
real, intent(in) :: a
baz = a
end
program main
real :: a
!$omp declare target(baz)
integer, save :: baz ! error: 'baz' is already declared
end
```
Instead of flagging an error, the 'baz' in the directive should be
resolved to the explicitly declared variable.
The original motivating example was to allow the case where the main
program (from the above snippet) looked like the following:
```
program main
real :: a
!$omp declare target(baz) ! 'baz' should be resolved to the
!$omp target ! external function
a = baz(a) ! <- because of this call
!$omp end target
end
```
The problem is that "declare_target(baz)" despite being the same in both
cases, should lead to two different outcomes in symbol resolution.
This fix will treat declarations introduced by a DECLARE_TARGET as
eligible for overriding with a potentially conflicting declaration
stemming from the use of that name in a language construct or expression.
Since a mere mention of a name alone declares an object, such conflict
occurs when the name would have been otherwise resolved to a procedure.
The function HandleProcedureName was modified to "undeclare" names
implicitly declared due to their appearance in a DECLARE_TARGET.
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