forked from OSchip/llvm-project
[flang] Fix bug with host-association in module procedure interface body
A module procedure interface body can access entities in its host without an IMPORT statement. So the `ImportKind` of the scope created for such an interface body should be `Default`, not `None` as it is for other interface bodies. Original-commit: flang-compiler/f18@24bb2668fd Reviewed-on: https://github.com/flang-compiler/f18/pull/305 Tree-same-pre-rewrite: false
This commit is contained in:
parent
0b9621b635
commit
ebcfd01ae3
|
@ -145,10 +145,10 @@ Scope::ImportKind Scope::GetImportKind() const {
|
|||
if (importKind_) {
|
||||
return *importKind_;
|
||||
}
|
||||
if (symbol_) {
|
||||
if (symbol_ && !symbol_->attrs().test(Attr::MODULE)) {
|
||||
if (auto *details{symbol_->detailsIf<SubprogramDetails>()}) {
|
||||
if (details->isInterface()) {
|
||||
return ImportKind::None; // default for interface body
|
||||
return ImportKind::None; // default for non-mod-proc interface body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
! Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
!
|
||||
! Licensed under the Apache License, Version 2.0 (the "License");
|
||||
! you may not use this file except in compliance with the License.
|
||||
|
@ -22,6 +22,15 @@ module m
|
|||
!REF: /m/t
|
||||
!DEF: /m/x PUBLIC ObjectEntity TYPE(t)
|
||||
type(t) :: x
|
||||
interface
|
||||
!DEF: /m/s3 MODULE, PUBLIC Subprogram
|
||||
!DEF: /m/s3/y ObjectEntity TYPE(t)
|
||||
module subroutine s3(y)
|
||||
!REF: /m/t
|
||||
!REF: /m/s3/y
|
||||
type(t) :: y
|
||||
end subroutine
|
||||
end interface
|
||||
contains
|
||||
!DEF: /m/s PUBLIC Subprogram
|
||||
subroutine s
|
||||
|
|
Loading…
Reference in New Issue