[all-commits] [llvm/llvm-project] fc5109: [flang] Fix edge case in USE-associated generics

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Feb 11 16:55:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc510998f7c287df2bc1304673e0cd8452d50b31
      https://github.com/llvm/llvm-project/commit/fc510998f7c287df2bc1304673e0cd8452d50b31
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2022-02-11 (Fri, 11 Feb 2022)

  Changed paths:
    M flang/lib/Semantics/program-tree.cpp
    M flang/lib/Semantics/program-tree.h
    M flang/lib/Semantics/resolve-names.cpp
    M flang/test/Semantics/resolve18.f90

  Log Message:
  -----------
  [flang] Fix edge case in USE-associated generics

It is generally an error when a USE-associated name clashes
with a name defined locally, but not in all cases; a generic
interface can be both USE-associated and locally defined.
This works, but not when there is also a local subprogram
with the same name, which is valid when that subprogram is
a specific of the local generic.  A bogus error issues at
the point of the USE because name resolution will have already
defined a symbol for the local subprogram.

The solution is to collect the names of local generics when
creating the program tree, and then create their symbols as
well if their names are also local subprograms, prior to any
USE association processing.

Differential Revision: https://reviews.llvm.org/D119566




More information about the All-commits mailing list