[flang] Substrings with lower bound greater than upper bound
authorPeter Steinfeld <psteinfeld@nvidia.com>
Wed, 16 Sep 2020 21:42:30 +0000 (14:42 -0700)
committerPeter Steinfeld <psteinfeld@nvidia.com>
Wed, 16 Sep 2020 21:56:23 +0000 (14:56 -0700)
commitdd3eb3f33239b23a12dd8864ae236390adf79550
tree34c3eeada8ece91774030e9b961f6d8c62e3c1ea
parent23bef7ee9923b1262326981960397e8cd95d6923
[flang] Substrings with lower bound greater than upper bound

According to section 9.4.1, paragraph 3,
 If the starting point is greater than the ending point, the substring has
 length zero

But the compilers code for substring processing was failing a call to `CHECK()`
in this case.  I fixed this by just setting the number of items in the
resulting string to 0 for this situation.

Differential Revision: https://reviews.llvm.org/D87799
flang/lib/Evaluate/variable.cpp
flang/test/Semantics/resolve49.f90