[all-commits] [llvm/llvm-project] 7a4570: [flang] sanitize set_length in lowering (#80412)

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Feb 2 05:08:12 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a4570acdb1a32935d96831142748ba3298a2b7f
      https://github.com/llvm/llvm-project/commit/7a4570acdb1a32935d96831142748ba3298a2b7f
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-02-02 (Fri, 02 Feb 2024)

  Changed paths:
    M flang/lib/Lower/ConvertExprToHLFIR.cpp
    M flang/test/Lower/HLFIR/array-ctor-character.f90

  Log Message:
  -----------
  [flang] sanitize set_length in lowering (#80412)

In fortran, it is possible to give a negative "i" in "character(i)" in
which case the standard says the length is zero. So the length must be
sanitized as max(0, user_input) in lowering.

This is already done when lowering specification parts, but was not done
when "character(i)" appears in array constructors. Sanitize the length
when lowering SetLength in lowering.

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




More information about the All-commits mailing list