[PATCH] D92492: [flang] Fix bugs related to merging generics during USE

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 09:16:29 PST 2020


tskeith created this revision.
tskeith added a project: Flang.
Herald added subscribers: llvm-commits, jdoerfert, mgorny.
Herald added a project: LLVM.
tskeith requested review of this revision.

When the same generic name is use-associated from two modules, the
generics are merged into a single one in the current scope. This change
fixes some bugs in that process.

When a generic is merged, it can have two specific procedures with the
same name as the generic (c.f. module m7c in modfile07.f90). We were
disallowing that by checking for duplicate names in the generic rather
than duplicate symbols. Changing `namesSeen` to `symbolsSeen` in
`ResolveSpecificsInGeneric` fixes that.

We weren't including each USE of those generics in the .mod file so in
some cases they were incorrect. Extend GenericDetails to specify all
use-associated symbols that are merged into the generic. This is used to
write out .mod files correctly.

The distinguishability check for specific procedures of a generic
sometimes have to refer to procedures from a use-associated generic in
error messages. In that case we don't have the source location of the
procedure so adapt the message to say where is was use-associated from.
This requires passing the scope through the checks to make that
determination.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92492

Files:
  flang/include/flang/Semantics/symbol.h
  flang/lib/Semantics/CMakeLists.txt
  flang/lib/Semantics/check-declarations.cpp
  flang/lib/Semantics/mod-file.cpp
  flang/lib/Semantics/resolve-names.cpp
  flang/lib/Semantics/symbol.cpp
  flang/test/Semantics/getsymbols03-a.f90
  flang/test/Semantics/modfile07.f90
  flang/test/Semantics/resolve17.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92492.308993.patch
Type: text/x-patch
Size: 27843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201202/b2126f61/attachment.bin>


More information about the llvm-commits mailing list