[flang][lowering] handle MERGE with different FSOURCE and TSOURCE types
authorValentin Clement <clementval@gmail.com>
Fri, 24 Jun 2022 19:04:24 +0000 (21:04 +0200)
committerValentin Clement <clementval@gmail.com>
Fri, 24 Jun 2022 19:05:15 +0000 (21:05 +0200)
commit56c81d2554baa208ca697b3ea958613d48a7b963
tree6e216ef1bad458b013b318f192865a36a4b9facf
parentfaf5e0ec737a676088649d7c13cb50f3f91a703a
[flang][lowering] handle MERGE with different FSOURCE and TSOURCE types

In merge FSOURCE and TSOURCE must have the same Fortran dynamic types,
but this does not imply that FSOURCE and TSOURCE will be lowered to the
same MLIR types. For instance, TSOURCE may be a character expression
with a compile type constant length (!fir.char<1,4>) while FSOURCE may
have dynamic length (!fir.char<1,?>).

Cast FSOURCE to TSOURCE MLIR types to handle these cases.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D128507

Co-authored-by: Jean Perier <jperier@nvidia.com>
flang/lib/Lower/IntrinsicCall.cpp
flang/test/Lower/Intrinsics/merge.f90