[PATCH] D85580: [flang] Fix assert on character literal substrings as arguments

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 20:35:47 PDT 2020


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

Character literal substrings used as arguments were causing asserts.  This
happened when the code was trying to get the DynamicType of the substring.  We
were only recording the DynamicType of the Designator on which the substring
was based.  For character literal substrings, the Designator was a character
literal, and we weren't handling getting its type.

I fixed this by changing the `GetType()` method for `DynamicType` to check to
see if we were getting the type of a `Substring` and calling the `GetType()`
method of `Substring` in that case.  This required adding a `GetType()` method
to the `Substring` class.  This, in turn, required modifying the `Substring`
constructors to take the kind of the base substring as an argument.

I also changed the test `resolve49.f90` with some tests, one of which causes
the original crash.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85580

Files:
  flang/include/flang/Evaluate/variable.h
  flang/lib/Evaluate/fold-designator.cpp
  flang/lib/Evaluate/fold.cpp
  flang/lib/Evaluate/variable.cpp
  flang/lib/Semantics/expression.cpp
  flang/test/Semantics/resolve49.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85580.284111.patch
Type: text/x-patch
Size: 6539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200808/25baf39e/attachment.bin>


More information about the llvm-commits mailing list