[flang] Check for duplicate definitions of defined input/output procedures
It's possible to specify defined input/output procedures either as a type-bound procedure of a derived type or as a defined-io-generic-spec. This means that you can specify the same procedure in both mechanisms, which does not cause problems. Alternatively, you can specify two different procedures to be the defined input/output procedure for the same derived type. This is an error. This change catches this error. The situation is slightly complicated by parameterized derived types. Types with the same value for a KIND parameter are treated as the same type while types with different KIND parameters are treated as different types. I implemented this check by adding a vector to keep track of which defined input/output procedures had been seen for which derived types along with the kind of procedure (read vs write and formatted vs unformatted). I also added tests for non-parameterized types and types parameterized by KIND and LEN type parameters. I also removed an erroneous check from the code that creates runtime type information. Differential Revision: https://reviews.llvm.org/D103560
Showing
- flang/lib/Semantics/check-declarations.cpp 40 additions, 9 deletionsflang/lib/Semantics/check-declarations.cpp
- flang/lib/Semantics/runtime-type-info.cpp 0 additions, 6 deletionsflang/lib/Semantics/runtime-type-info.cpp
- flang/test/Semantics/io11.f90 250 additions, 0 deletionsflang/test/Semantics/io11.f90
Loading
Please register or sign in to comment