[all-commits] [llvm/llvm-project] c0cb8f: [flang] Fix character function call bug (#67973)

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Oct 2 08:37:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c0cb8f73b07eb96808f58489c8041203194c6c3b
      https://github.com/llvm/llvm-project/commit/c0cb8f73b07eb96808f58489c8041203194c6c3b
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/lib/Optimizer/Builder/Character.cpp
    M flang/test/Lower/HLFIR/bindc-entry-stmt.f90
    M flang/test/Lower/HLFIR/calls-assumed-shape.f90
    M flang/test/Lower/HLFIR/char_extremum.f03
    M flang/test/Lower/HLFIR/convert-variable.f90
    M flang/test/Lower/HLFIR/function-return.f90
    M flang/test/Lower/HLFIR/structure-constructor.f90
    M flang/test/Lower/Intrinsics/merge.f90
    M flang/test/Lower/OpenMP/FIR/copyin.f90
    M flang/test/Lower/OpenMP/FIR/private-commonblock.f90
    M flang/test/Lower/allocatable-assignment.f90
    M flang/test/Lower/allocatable-callee.f90
    M flang/test/Lower/allocatables.f90
    M flang/test/Lower/array-elemental-calls-char-byval.f90
    M flang/test/Lower/array-elemental-calls-char.f90
    M flang/test/Lower/array-expression.f90
    M flang/test/Lower/call-by-value-attr.f90
    M flang/test/Lower/call-by-value.f90
    M flang/test/Lower/call-implicit.f90
    M flang/test/Lower/call-parenthesized-arg.f90
    M flang/test/Lower/derived-allocatable-components.f90
    M flang/test/Lower/derived-pointer-components.f90
    M flang/test/Lower/derived-types.f90
    M flang/test/Lower/dummy-argument-optional-2.f90
    M flang/test/Lower/dummy-argument-optional.f90
    M flang/test/Lower/entry-statement.f90
    M flang/test/Lower/host-associated.f90
    M flang/test/Lower/implicit-call-mismatch.f90
    M flang/test/Lower/pointer-args-caller.f90

  Log Message:
  -----------
  [flang] Fix character function call bug (#67973)

Fixes https://github.com/llvm/llvm-project/issues/67658

The bug was that when instantiating a character array result variable,
the code inserted a cast from the result buffer to the proper array type
if it could see an fir.unboxchar op. But this is wrong for results and
on caller side because the fir.emboxchar is visible so,
charHelper.genUnboxChar() just takes the operand from that instead of
generating an unboxchar.

The fix is simply to move the cast at the place where fir.boxchar<>
argument are dealt with. The cast when creating fir.emboxchar is also
removed: it adds noise and causes constant length result type to be
lowered to fir.char<?>.

The main change from this patch is to deal with the lit test fallout of
this cast move and removal.




More information about the All-commits mailing list