[flang] Take result length into account in ApplyElementwise folding
authorJean Perier <jperier@nvidia.com>
Thu, 26 Aug 2021 07:44:24 +0000 (09:44 +0200)
committerJean Perier <jperier@nvidia.com>
Thu, 26 Aug 2021 07:46:14 +0000 (09:46 +0200)
commit9016b2a1cae244eb8f26826427eeb90eded0da20
treed7ea1f96c20128b5c0892a7da8d6f0f236bcceff
parentfdefde4965d0c91250e657ab52f47b6dff286cc7
[flang] Take result length into account in ApplyElementwise folding

ApplyElementwise on character operation was always creating a result
ArrayConstructor with the length of the left operand. This is not
correct for concatenation and SetLength operations.

Compute and thread the length to the spot creating the ArrayConstructor
so that the length is correct for those character operations.

Differential Revision: https://reviews.llvm.org/D108711
flang/lib/Evaluate/fold-implementation.h
flang/test/Evaluate/folding22.f90 [new file with mode: 0644]