[all-commits] [llvm/llvm-project] adaf62: [Sema] Reject array element types whose sizes aren...

Akira Hatanaka via All-commits all-commits at lists.llvm.org
Wed Sep 21 09:17:14 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: adaf62ced2a106b9f16974f09ef6294583637288
      https://github.com/llvm/llvm-project/commit/adaf62ced2a106b9f16974f09ef6294583637288
  Author: Akira Hatanaka <ahatanaka at apple.com>
  Date:   2022-09-21 (Wed, 21 Sep 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/test/CodeGenCXX/override-layout-packed-base.cpp
    M clang/test/CodeGenCXX/ubsan-new-checks.cpp
    M clang/test/Layout/ms-aligned-array.c
    M clang/test/Layout/ms-x86-misalignedarray.cpp
    M clang/test/Sema/align-x86-64.c
    M clang/test/Sema/align-x86.c
    M clang/test/Sema/attr-aligned.c
    M clang/test/SemaCXX/align-x86.cpp
    A clang/test/SemaCXX/array-alignment.cpp
    M clang/test/SemaCXX/warn-new-overaligned.cpp

  Log Message:
  -----------
  [Sema] Reject array element types whose sizes aren't a multiple of their
alignments

In the following code, the first element is aligned on a 16-byte
boundary, but the remaining elements aren't:

```
typedef char int8_a16 __attribute__((aligned(16)));
int8_a16 array[4];
```

Currently clang doesn't reject the code, but it should since it can
cause crashes at runtime. This patch also fixes assertion failures in
CodeGen caused by the changes in https://reviews.llvm.org/D123649.

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




More information about the All-commits mailing list