[all-commits] [llvm/llvm-project] 27cfe7: [flang] Set assumed-size last extent to -1 (#79156)

jeanPerier via All-commits all-commits at lists.llvm.org
Wed Jan 24 04:24:07 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 27cfe7a07fc858bd890f2e0980f530a8573748b0
      https://github.com/llvm/llvm-project/commit/27cfe7a07fc858bd890f2e0980f530a8573748b0
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    R flang/include/flang/Optimizer/Builder/Array.h
    M flang/include/flang/Optimizer/Builder/BoxValue.h
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/lib/Lower/DirectivesCommon.h
    M flang/lib/Lower/OpenMP.cpp
    M flang/lib/Optimizer/Builder/BoxValue.cpp
    M flang/lib/Optimizer/Builder/IntrinsicCall.cpp
    M flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
    A flang/test/Lower/HLFIR/assumed-size-cray-pointee.f90
    M flang/test/Lower/HLFIR/cray-pointers.f90
    M flang/test/Lower/Intrinsics/lbound.f90
    M flang/test/Lower/Intrinsics/ubound.f90
    M flang/test/Lower/array-expression-assumed-size.f90
    M flang/test/Lower/cray-pointer.f90

  Log Message:
  -----------
  [flang] Set assumed-size last extent to -1 (#79156)

Currently lowering sets the extents of assumed-size array to "undef"
which was OK as long as the value was not expected to be read.

But when interfacing with the runtime and when passing assumed-size to
assumed-rank, this last extent may be read and must be -1 as specified
in the BIND(C) case in 18.5.3 point 5.

Set this value to -1, and update all the lowering code that was looking
for an undef defining op to identify assumed-size: much safer to
propagate and use semantic info here, the previous check actually did
not work if the array was used in an internal procedure (defining op not
visible anymore).

@clementval and @agozillon, I left assumed-size extent to zero in the
acc/omp bounds op as it was, please double check that is what you want
(I can imagine -1 may create troubles here, and 0 makes some sense as it
would lead to no data transfer).

This also allows removing special cases in UBOUND/LBOUND lowering.

Also disable allocation of cray pointee. This was never intended and
would now lead to crashes with the -1 value for assumed-size cray
pointee.




More information about the All-commits mailing list