mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 19:16:43 +00:00
[flang] Don't set Subroutine flag on PROCEDURE() pointers (#102011)
External procedures about which no characteristics are known -- from EXTERNAL and PROCEDURE() statements of entities that are never called -- are marked as subroutines. This shouldn't be done for procedure pointers, however. Fixes https://github.com/llvm/llvm-project/issues/101908.
This commit is contained in:
parent
28ba8a56b6
commit
d9af9cf436
@ -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
|
||||
|
@ -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)
|
||||
@ -324,4 +328,10 @@ contains
|
||||
!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…
x
Reference in New Issue
Block a user