[all-commits] [llvm/llvm-project] bdb5b4: [flang] Fix length handling in character kind impl...

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Dec 8 06:26:09 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bdb5b4421593d61c454abf3148aabcd4c2ff7811
      https://github.com/llvm/llvm-project/commit/bdb5b4421593d61c454abf3148aabcd4c2ff7811
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M flang/lib/Optimizer/Builder/HLFIRTools.cpp
    M flang/test/Lower/HLFIR/implicit-type-conversion-allocatable.f90

  Log Message:
  -----------
  [flang] Fix length handling in character kind implicit conversion (#74586)

When assigning to a whole allocatable, lowering is dealing with the
implicit conversion to preserve the RHS lower bounds. In case of
character KIND mismatch, the code was setting the new RHS length to the
one from the LHS, which is wrong for two reasons:
- no padding/truncation was actually done in the conversion
- the RHS length should anyway not be touched since the one from the
allocatable LHS may change to become the one of the RHS.

Update the code to preserve the RHS type length when materializing the
implicit character KIND conversion.




More information about the All-commits mailing list