[flang] Fix a bug in the character runtime
authorDiana Picus <diana.picus@linaro.org>
Tue, 27 Apr 2021 08:56:14 +0000 (08:56 +0000)
committerDiana Picus <diana.picus@linaro.org>
Mon, 3 May 2021 08:08:08 +0000 (08:08 +0000)
commit5112bd6b6e10b27b81aa83cfdbe3588973a6f1f5
tree2e2d5b6f2ff74eb23e212cc1bf7bff9593b43af7
parentaaab70407beb9526722b04ae3dd14def4eaab540
[flang] Fix a bug in the character runtime

The number of bytes copied in CopyAndPad should depend on the size of
the type being copied, not on its shift value (which in the case of char
is 0, leading to no bytes at all being copied).

Add unit tests for CharacterMin and CharacterMax, which exercise this
code path.

Differential Revision: https://reviews.llvm.org/D101355
flang/runtime/character.cpp
flang/unittests/RuntimeGTest/CharacterTest.cpp