-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Flang] Use specific symbol rather than generic symbol as procInterface to declare procedure pointer. #80738
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
Conversation
@llvm/pr-subscribers-flang-semantics Author: Daniel Chen (DanielCChen) ChangesFlang crashes when lowering the type of
Full diff: https://github.com/llvm/llvm-project/pull/80738.diff 1 Files Affected:
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 6914f95837f676..36deab969456d0 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -5648,7 +5648,9 @@ void DeclarationVisitor::Post(const parser::ProcDecl &x) {
const auto &name{std::get<parser::Name>(x.t)};
const Symbol *procInterface{nullptr};
if (interfaceName_) {
- procInterface = interfaceName_->symbol;
+ procInterface = interfaceName_->symbol->has<GenericDetails>()
+ ? interfaceName_->symbol->get<GenericDetails>().specific()
+ : interfaceName_->symbol;
}
auto attrs{HandleSaveName(name.source, GetAttrs())};
DerivedTypeDetails *dtDetails{nullptr};
|
…terface to declare procedure pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Daniel, this makes sense to me.
Thanks for the review! |
…modules (#81087) The following test cases crashes. The problem is that the fix for PR #80738 is not quite complete. It should `GetUltimate()` of the `interface_` before check if it is generic. ``` MODULE M CONTAINS FUNCTION Int(Arg) INTEGER :: Int, Arg Int = Arg END FUNCTION FUNCTION Int8(Arg) INTEGER(8) :: Int8, Arg Int8 = 8_8 END FUNCTION END MODULE MODULE M1 USE M INTERFACE Int8 MODULE PROCEDURE Int MODULE PROCEDURE Int8 END INTERFACE END MODULE PROGRAM PtrAssignGen USE M USE M1 IMPLICIT NONE INTERFACE Int MODULE PROCEDURE Int MODULE PROCEDURE Int8 END INTERFACE PROCEDURE(Int8), POINTER :: PtrInt8 PtrInt8 => Int8 IF ( PtrInt8(100_8) .NE. 8_8 ) ERROR STOP 12 END ```
…erent way by adding a GenericDetails in GetTypeImpl.
…erent way by adding a GenericDetails in GetTypeImpl.
Flang crashes when lowering the type of
p1
with the following code. The problem is when it sets up theprocInterface
, it uses the generic symbolint
, not the specificint
. This PR is to correct that.