[all-commits] [llvm/llvm-project] 53b387: [Support][unittests] Enforce alignment in ConvertU...

rorth via All-commits all-commits at lists.llvm.org
Wed Oct 7 00:09:22 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 53b3873cf428fd78f1d92504cc20adf11181ead7
      https://github.com/llvm/llvm-project/commit/53b3873cf428fd78f1d92504cc20adf11181ead7
  Author: Rainer Orth <ro at gcc.gnu.org>
  Date:   2020-10-07 (Wed, 07 Oct 2020)

  Changed paths:
    M llvm/lib/Support/ConvertUTFWrapper.cpp
    M llvm/unittests/Support/ConvertUTFTest.cpp

  Log Message:
  -----------
  [Support][unittests] Enforce alignment in ConvertUTFTest

`LLVM-Unit :: Support/./SupportTests/ConvertUTFTest.ConvertUTF16LittleEndianToUTF8String`
`FAIL`s on Solaris/sparcv9:

In `llvm/lib/Support/ConvertUTFWrapper.cpp` (`convertUTF16ToUTF8String`)
the `SrcBytes` arg is reinterpreted/accessed as `UTF16` (`unsigned short`,
which requires 2-byte alignment on strict-alignment targets like Sparc)
without anything guaranteeing the alignment, so the access yields a
`SIGBUS`.

This patch avoids this by enforcing the required alignment in the callers.

Tested on `sparcv9-sun-solaris2.11`.

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




More information about the All-commits mailing list