[all-commits] [llvm/llvm-project] 704620: [flang] Move whole allocatable assignment implicit...

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Oct 27 00:08:02 PDT 2023


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

  Changed paths:
    M flang/include/flang/Optimizer/Builder/Character.h
    M flang/include/flang/Optimizer/Builder/HLFIRTools.h
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Lower/ConvertExprToHLFIR.cpp
    M flang/lib/Optimizer/Builder/Character.cpp
    M flang/lib/Optimizer/Builder/HLFIRTools.cpp
    M flang/lib/Semantics/expression.cpp
    M flang/test/Lower/HLFIR/charconvert.f90
    A flang/test/Lower/HLFIR/implicit-type-conversion-allocatable.f90
    M flang/test/Lower/charconvert.f90

  Log Message:
  -----------
  [flang] Move whole allocatable assignment implicit conversion to lowering (#70317)

The front-end is making implicit conversions explicit in assignment and
structure constructors.

While this generally helps and is needed by semantics to fold structure
constructors correctly, this is incorrect when the LHS or component is
an allocatable. The RHS may have non default lower bounds that should be
propagated to the LHS, and making the conversion explicit changes the
semantics. In the structure constructor, the situation is even worse
since Fortran 2018 7.5.10 point 7 allows the value to be a reference to
an unallocated allocatable, and adding an explicit conversion in
semantics will cause a segfault.

This patch removes the explicit convert in semantics when the
LHS/component is a whole allocatable, and update lowering to deal with
the conversion insertion, dealing with preserving the lower bounds and
the tricky structure constructor case.




More information about the All-commits mailing list