Skip to content

[flang] Don't set Subroutine flag on PROCEDURE() pointers #102011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9235,7 +9235,7 @@ void ResolveNamesVisitor::ResolveSpecificationParts(ProgramTree &node) {
node.GetKind() == ProgramTree::Kind::Submodule};
for (auto &pair : *node.scope()) {
Symbol &symbol{*pair.second};
if (inModule && symbol.attrs().test(Attr::EXTERNAL) &&
if (inModule && symbol.attrs().test(Attr::EXTERNAL) && !IsPointer(symbol) &&
!symbol.test(Symbol::Flag::Function) &&
!symbol.test(Symbol::Flag::Subroutine)) {
// in a module, external proc without return type is subroutine
Expand Down
10 changes: 10 additions & 0 deletions flang/test/Semantics/assign03.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
! Pointer assignment constraints 10.2.2.2 (see also assign02.f90)

module m0
procedure(),pointer,save :: p
end

module m
interface
subroutine s(i)
Expand Down Expand Up @@ -324,4 +328,10 @@ subroutine s14
!ERROR: Statement function 'sf' may not be the target of a pointer assignment
ptr => sf
end subroutine

subroutine s15
use m0
intrinsic sin
p=>sin ! ok
end
end
Loading