xref: /aosp_15_r20/external/clang/test/Sema/sizeof-struct-non-zero-as-member.cl (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -verify -fsyntax-only -triple amdgcn -target-cpu verde -S -emit-llvm -o - %s
2*67e74705SXin Li// expected-no-diagnostics
3*67e74705SXin Li
4*67e74705SXin Li// Record lowering was crashing on SI and newer targets, because it
5*67e74705SXin Li// was using the wrong size for test::ptr.  Since global memory
6*67e74705SXin Li// has 64-bit pointers, sizeof(test::ptr) should be 8.
7*67e74705SXin Li
8*67e74705SXin Listruct test_as0 {int *ptr;};
9*67e74705SXin Liconstant int as0[sizeof(struct test_as0) == 4 ? 1 : -1] = { 0 };
10*67e74705SXin Li
11*67e74705SXin Listruct test_as1 {global int *ptr;};
12*67e74705SXin Liconstant int as1[sizeof(struct test_as1) == 8 ? 1 : -1] = { 0 };
13*67e74705SXin Li
14*67e74705SXin Listruct test_as2 {constant int *ptr;};
15*67e74705SXin Liconstant int as2[sizeof(struct test_as2) == 8 ? 1 : -1] = { 0 };
16*67e74705SXin Li
17*67e74705SXin Listruct test_as3 {local int *ptr;};
18*67e74705SXin Liconstant int as3[sizeof(struct test_as3) == 4 ? 1 : -1] = { 0 };
19