[flang] Correct the subscripts used for arguments to character intrinsics
authorpeter klausler <pklausler@nvidia.com>
Tue, 15 Jun 2021 22:09:04 +0000 (15:09 -0700)
committerpeter klausler <pklausler@nvidia.com>
Wed, 16 Jun 2021 17:26:25 +0000 (10:26 -0700)
commit8ba9ee46e465a56a54f8361703d3af7f4bc98d63
treebce830abb649f1e67befac92ef1e04f9908f361e
parent773ad55a393f368cc92b1611c52e493ed45a353f
[flang] Correct the subscripts used for arguments to character intrinsics

When chasing down another unrelated bug, I noticed that the
implementations of various character intrinsic functions assume
that the lower bounds of (some of) their arguments were 1.
This isn't necessarily the case, so I've cleaned them up, tweaked
the unit tests to exercise the fix, and regularized the allocation
pattern used for results to use SetBounds() before Allocate() rather
than the old original Descriptor::Allocate() wrapper around
CFI_allocate().

Since there were few other remaining uses of the old original
Descriptor::Allocate() wrapper, I also converted them to the
new one and deleted the old one.

Differential Revision: https://reviews.llvm.org/D104325
flang/runtime/character.cpp
flang/runtime/descriptor.cpp
flang/runtime/descriptor.h
flang/runtime/transformational.cpp
flang/unittests/Evaluate/reshape.cpp
flang/unittests/RuntimeGTest/CharacterTest.cpp