[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 14:41:40 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: clang/test/Layout/aix-double-struct-member.cpp:2
+// RUN: %clang_cc1 -emit-llvm-only -triple powerpc-ibm-aix-xcoff \
+// RUN:     -fdump-record-layouts -fsyntax-only %s 2>/dev/null | \
+// RUN:   FileCheck %s
----------------
My build with this patch also hits cases where the preferred alignment is increased to 8, but the offset of the associated member is not 8-byte aligned:
```
extern "C" int printf(const char *, ...);
struct A0 {};
struct Y : A0 {
  double mem;
};
struct Z : A0 {
  Y y;
};
extern char alignz[__alignof__(Z)];
extern char alignz[8];
int main(void) {
  Z z;
  printf("%td\n",
         &reinterpret_cast<char &>(z.y) - &reinterpret_cast<char &>(z));
}
```
```
*** Dumping AST Record Layout
         0 | struct Z
         0 |   struct A0 (base) (empty)
         4 |   struct Y y
         4 |     struct A0 (base) (empty)
         4 |     double mem
           | [sizeof=16, dsize=12, align=4, preferredalign=8,
           |  nvsize=12, nvalign=4, preferrednvalign=8]
```



================
Comment at: clang/test/Layout/aix-double-struct-member.cpp:237
+
+namespace tes8 {
+// Test how #pragma pack and align attribute interacts with AIX alignment.
----------------
Typo: s/tes8/test8/;


================
Comment at: clang/test/Layout/aix-double-struct-member.cpp:347
+
+} // namespace tes8
----------------
Same comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79719/new/

https://reviews.llvm.org/D79719





More information about the cfe-commits mailing list