[PATCH] D103560: [flang] Check for duplicate definitions of defined input/output procedures

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 2 14:58:09 PDT 2021


PeteSteinfeld created this revision.
PeteSteinfeld requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103560

Files:
  flang/lib/Semantics/check-declarations.cpp
  flang/lib/Semantics/runtime-type-info.cpp
  flang/test/Semantics/io11.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103560.349390.patch
Type: text/x-patch
Size: 12905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210602/ff8933ed/attachment.bin>


More information about the llvm-commits mailing list