Skip to content

Commit 7e4ac85

Browse files
authored
[Flang] Use specific symbol rather than generic symbol as procInterface to declare procedure pointer. (#80738)
Flang crashes when lowering the type of `p1` with the following code. The problem is when it sets up the `procInterface`, it uses the generic symbol `int`, not the specific `int`. This PR is to correct that. ``` INTERFACE Int integer FUNCTION Int(arg) integer :: arg END FUNCTION END INTERFACE integer :: res procedure(int), pointer :: p1 p1 => int res = p1(4) end ```
1 parent 7212b4a commit 7e4ac85

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5648,7 +5648,9 @@ void DeclarationVisitor::Post(const parser::ProcDecl &x) {
56485648
const auto &name{std::get<parser::Name>(x.t)};
56495649
const Symbol *procInterface{nullptr};
56505650
if (interfaceName_) {
5651-
procInterface = interfaceName_->symbol;
5651+
procInterface = interfaceName_->symbol->has<GenericDetails>()
5652+
? interfaceName_->symbol->get<GenericDetails>().specific()
5653+
: interfaceName_->symbol;
56525654
}
56535655
auto attrs{HandleSaveName(name.source, GetAttrs())};
56545656
DerivedTypeDetails *dtDetails{nullptr};

0 commit comments

Comments
 (0)