[all-commits] [llvm/llvm-project] 22d7e2: [flang] Check for duplicate definitions of defined...

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Thu Jun 3 07:39:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 22d7e298dc35a2319d7b71ee78732b0a3a86893d
      https://github.com/llvm/llvm-project/commit/22d7e298dc35a2319d7b71ee78732b0a3a86893d
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2021-06-03 (Thu, 03 Jun 2021)

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

  Log Message:
  -----------
  [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




More information about the All-commits mailing list