1 | // XFAIL: * |
2 | // |
3 | // RUN: %clangxx_host -gdwarf -o %t %s |
4 | // RUN: %lldb %t \ |
5 | // RUN: -o "expr alignof(base)" \ |
6 | // RUN: -o "expr alignof(packed_base)" \ |
7 | // RUN: -o "expr alignof(derived)" \ |
8 | // RUN: -o "expr sizeof(derived)" \ |
9 | // RUN: -o exit | FileCheck %s |
10 | |
11 | struct __attribute__((packed)) packed { |
12 | int x; |
13 | char y; |
14 | int z; |
15 | } g_packed_struct; |
16 | |
17 | // LLDB incorrectly calculates alignof(base) |
18 | struct foo {}; |
19 | struct base : foo { int x; }; |
20 | static_assert(alignof(base) == 4); |
21 | |
22 | // CHECK: (lldb) expr alignof(base) |
23 | // CHECK-NEXT: ${{.*}} = 4 |
24 | |
25 | // LLDB incorrectly calculates alignof(packed_base) |
26 | struct __attribute__((packed)) packed_base { int x; }; |
27 | static_assert(alignof(packed_base) == 1); |
28 | |
29 | // CHECK: (lldb) expr alignof(packed_base) |
30 | // CHECK-NEXT: ${{.*}} = 1 |
31 | |
32 | struct derived : packed, packed_base { |
33 | short s; |
34 | } g_derived; |
35 | static_assert(alignof(derived) == 2); |
36 | static_assert(sizeof(derived) == 16); |
37 | |
38 | // CHECK: (lldb) expr alignof(derived) |
39 | // CHECK-NEXT: ${{.*}} = 2 |
40 | // CHECK: (lldb) expr sizeof(derived) |
41 | // CHECK-NEXT: ${{.*}} = 16 |
42 | |
43 | int main() {} |
44 | |