[all-commits] [llvm/llvm-project] a3e9d3: [flang] Allow reference to earlier generic in late...
Peter Klausler via All-commits
all-commits at lists.llvm.org
Tue Aug 8 12:20:09 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a3e9d3c2c7e9f8766bf03c63e43675258cc611ee
https://github.com/llvm/llvm-project/commit/a3e9d3c2c7e9f8766bf03c63e43675258cc611ee
Author: Peter Klausler <pklausler at nvidia.com>
Date: 2023-08-08 (Tue, 08 Aug 2023)
Changed paths:
M flang/lib/Semantics/mod-file.cpp
M flang/lib/Semantics/resolve-names.cpp
M flang/test/Semantics/modfile07.f90
M flang/test/Semantics/modfile32.f90
M flang/test/Semantics/modfile33.f90
M flang/test/Semantics/modfile38.f90
M flang/test/Semantics/modfile39.f90
M flang/test/Semantics/modfile44.f90
M flang/test/Semantics/resolve15.f90
M flang/test/Semantics/resolve25.f90
M flang/test/Semantics/resolve77.f90
Log Message:
-----------
[flang] Allow reference to earlier generic in later interface
Name resolutions defers all resolution and checking of specific procedures
in non-type-bound generic interfaces to the end of the specification part.
This prevents expression analysis of references to generic functions in
specification expressions in interfaces from resolving.
Example (now a new test case in modfile07.f90):
```
module m12
interface generic
module procedure specific
end interface
interface
module subroutine s(a1,a2)
character(*) a1
character(generic(a1)) a2 ! <--
end
end interface
contains
pure integer function specific(x)
character(*), intent(in) :: x
specific = len(x)
end
end
```
The solution is to partially resolve specific procedures as they are
defined for each generic, when they can be resolved, with the final
pass at the end of the specification part to finish up any forward
references and emit the necessary error messages.
Making this fix caused some issues in module file output, which have
all been resolved by making this simplifying change: generics are
now all emitted to module file specification parts as their own
group of declarations at the end of the specification part,
followed only by namelists and COMMON blocks.
Differential Revision: https://reviews.llvm.org/D157346
More information about the All-commits
mailing list