[all-commits] [llvm/llvm-project] d667b9: [flang] Fix assignment of parameterized derived types

Pete Steinfeld via All-commits all-commits at lists.llvm.org
Tue Apr 20 12:42:25 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d667b96c98438edcc00ec85a3b151ac2dae862f3
      https://github.com/llvm/llvm-project/commit/d667b96c98438edcc00ec85a3b151ac2dae862f3
  Author: Peter Steinfeld <psteinfeld at nvidia.com>
  Date:   2021-04-20 (Tue, 20 Apr 2021)

  Changed paths:
    M flang/include/flang/Semantics/type.h
    M flang/lib/Semantics/tools.cpp
    M flang/lib/Semantics/type.cpp
    M flang/test/Semantics/assign04.f90

  Log Message:
  -----------
  [flang] Fix assignment of parameterized derived types

We were erroneously emitting error messages for assignments of derived types
where the associated objects were instantiated with non-constant LEN type
parameters.

I fixed this by adding the member function MightBeAssignmentCompatibleWith() to
the class DerivedTypeSpec and calling it to determine whether it's possible
that objects of parameterized derived types can be assigned to each other.  Its
implementation first compares the uninstantiated values of the types.  If they
are equal, it then compares the values of the constant instantiated type
parameters.

I added tests to assign04.f90 to exercise this new code.

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




More information about the All-commits mailing list