[all-commits] [llvm/llvm-project] 32f901: [flang] Use CFI_TYPE_LAST instead of CFI_type_struct

Diana via All-commits all-commits at lists.llvm.org
Mon May 3 01:17:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 32f901bdf9b59a1cf43946ac7bb6c9382bc69600
      https://github.com/llvm/llvm-project/commit/32f901bdf9b59a1cf43946ac7bb6c9382bc69600
  Author: Diana Picus <diana.picus at linaro.org>
  Date:   2021-05-03 (Mon, 03 May 2021)

  Changed paths:
    M flang/runtime/ISO_Fortran_binding.cpp
    M flang/unittests/Evaluate/ISO-Fortran-binding.cpp

  Log Message:
  -----------
  [flang] Use CFI_TYPE_LAST instead of CFI_type_struct

It looks like CFI_type_struct was once used as the last valid CFI_type
value, but in the meantime CFI_type_char16_t and CFI_type_char32_t were
added, making that assumption no longer true. Luckily, in the meantime
we also got a define for CFI_TYPE_LAST, which we can now use to allow
CFI_establish and CFI_allocate to work with descriptors of
CFI_type_char16_t, CFI_type_char32_t and any other future types.

Differential Revision: https://reviews.llvm.org/D101658


  Commit: aaab70407beb9526722b04ae3dd14def4eaab540
      https://github.com/llvm/llvm-project/commit/aaab70407beb9526722b04ae3dd14def4eaab540
  Author: Diana Picus <diana.picus at linaro.org>
  Date:   2021-05-03 (Mon, 03 May 2021)

  Changed paths:
    M flang/runtime/ISO_Fortran_binding.cpp
    M flang/unittests/Evaluate/ISO-Fortran-binding.cpp

  Log Message:
  -----------
  [flang] Fix handling of elem_len in CFI_establish

The current code computes the minimum element length based on the `type`
used to create the descriptor and uses that as the element length
whenever it is greater than 0. This means that the `elem_len` parameter
is essentially ignored for any type where we can compute a minimum
element length (which includes `CFI_type_char[16|32]_t`), and we may
therefore end up with descriptors with a lower element length than
expected.

This patch fixes the issue by explicitly doing what the standard says,
i.e. it uses the given `elem_len` for character types, `CFI_type_struct`
and `CFI_type_other`, and ignores it (falls back to the minimum element
length) for everything else.

Differential Revision: https://reviews.llvm.org/D101659


  Commit: 5112bd6b6e10b27b81aa83cfdbe3588973a6f1f5
      https://github.com/llvm/llvm-project/commit/5112bd6b6e10b27b81aa83cfdbe3588973a6f1f5
  Author: Diana Picus <diana.picus at linaro.org>
  Date:   2021-05-03 (Mon, 03 May 2021)

  Changed paths:
    M flang/runtime/character.cpp
    M flang/unittests/RuntimeGTest/CharacterTest.cpp

  Log Message:
  -----------
  [flang] Fix a bug in the character runtime

The number of bytes copied in CopyAndPad should depend on the size of
the type being copied, not on its shift value (which in the case of char
is 0, leading to no bytes at all being copied).

Add unit tests for CharacterMin and CharacterMax, which exercise this
code path.

Differential Revision: https://reviews.llvm.org/D101355


Compare: https://github.com/llvm/llvm-project/compare/1f8963c80195...5112bd6b6e10


More information about the All-commits mailing list