From fdba48a74c24dbe9ef189ee3d0e24904fc7852a3 Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 20 Mar 2019 17:00:26 -0700 Subject: [PATCH] [flang] Don't add inherited procedures to generic binding In this example: ``` type t1 contains procedure, nopass :: s1 generic :: foo => s1 end type type, extends(t1) :: t2 contains procedure, nopass :: s2 generic :: foo => s2 end type ``` The GenericBindingDetails for foo in t2 include both s1 and s2 as specific procs. There is no way to distinguish between the binding in the current type and the binding that was inherited. In particular, the .mod file will have a binding for s1 in t2, so it won't match the original source (for exampke, see the old version of modfile14.f90). Original-commit: flang-compiler/f18@4e2c6be5cbdc5d31c41f0e44b85985b4fb69210d Reviewed-on: https://github.com/flang-compiler/f18/pull/368 Tree-same-pre-rewrite: false --- flang/lib/semantics/resolve-names.cc | 6 ------ flang/test/semantics/modfile14.f90 | 1 - 2 files changed, 7 deletions(-) diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 514a6a3..8073bbd 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -3278,7 +3278,6 @@ bool DeclarationVisitor::Pre(const parser::TypeBoundGenericStmt &x) { const SourceName &symbolName{info.symbolName()}; bool isPrivate{accessSpec ? accessSpec->v == parser::AccessSpec::Kind::Private : derivedTypeInfo_.privateBindings}; - const SymbolList *inheritedProcs{nullptr}; // specific procs from parent type auto *genericSymbol{FindInScope(currScope(), symbolName)}; if (genericSymbol) { if (!genericSymbol->has()) { @@ -3288,8 +3287,6 @@ bool DeclarationVisitor::Pre(const parser::TypeBoundGenericStmt &x) { FindInTypeOrParents(currScope(), symbolName)}) { // look in parent types: if (inheritedSymbol->has()) { - inheritedProcs = - &inheritedSymbol->get().specificProcs(); CheckAccessibility(symbolName, isPrivate, *inheritedSymbol); } } @@ -3305,9 +3302,6 @@ bool DeclarationVisitor::Pre(const parser::TypeBoundGenericStmt &x) { } } auto &details{genericSymbol->get()}; - if (inheritedProcs) { - details.add_specificProcs(*inheritedProcs); - } details.add_specificProcs(specificProcs); info.Resolve(genericSymbol); return false; diff --git a/flang/test/semantics/modfile14.f90 b/flang/test/semantics/modfile14.f90 index d504685..99bbb0e 100644 --- a/flang/test/semantics/modfile14.f90 +++ b/flang/test/semantics/modfile14.f90 @@ -58,7 +58,6 @@ end ! type,extends(t1)::t2 ! contains ! procedure,nopass::s4 -! generic::foo=>s2 ! generic::foo=>s3 ! generic::foo=>s4 ! end type -- 2.7.4