[PATCH] D100868: [flang] Fix assignment of parameterized derived types

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 10:11:55 PDT 2021


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

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100868

Files:
  flang/include/flang/Semantics/type.h
  flang/lib/Semantics/tools.cpp
  flang/lib/Semantics/type.cpp
  flang/test/Semantics/assign04.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100868.338913.patch
Type: text/x-patch
Size: 5553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210420/6f0f3222/attachment.bin>


More information about the llvm-commits mailing list