42 lines · c
1// off-no-diagnostics2// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify -fsyntax-only %s3// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -verify -fsyntax-only %s4// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify=off -Wno-aix-compat -fsyntax-only %s5// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -verify=off -Wno-aix-compat -fsyntax-only %s6// RUN: %clang_cc1 -triple powerpc64le-unknown-linux -verify=off -fsyntax-only %s7 8// We do not warn on any declaration with a member aligned 16. Only when the struct is passed byval.9struct R {10 int b[8] __attribute__((aligned(16))); // no-warning11};12 13struct S {14 int a[8] __attribute__((aligned(8))); // no-warning15 int b[8] __attribute__((aligned(16))); // expected-warning {{alignment of 16 bytes for a struct member is not binary compatible with IBM XL C/C++ for AIX 16.1.0 or older}}16};17 18struct T {19 int a[8] __attribute__((aligned(8))); // no-warning20 int b[8] __attribute__((aligned(4))); // no-warning21};22 23int a[8] __attribute__((aligned(8))); // no-warning24int b[4] __attribute__((aligned(16))); // no-warning25 26void baz(int a, int b, int *c, int d, int *e, int f, struct S);27void jaz(int a, int b, int *c, int d, int *e, int f, struct T);28void vararg_baz(int a,...);29static void static_baz(int a, int b, int *c, int d, int *e, int f, struct S sp2) {30 a = *sp2.b + *c + *e;31}32 33void foo(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,34 struct S s, struct T t) {35 36 baz(p1, p2, s.b, p3, b, p5, s); // expected-note {{passing byval argument 's' with potentially incompatible alignment here}}37 jaz(p1, p2, a, p3, s.a, p5, t); // no-note38 jaz(p1, p2, s.b, p3, b, p5, t); // no-note39 vararg_baz(p1, p2, s.b, p3, b, p5, s); // no-note40 static_baz(p1, p2, s.b, p3, b, p5, s); // no-note41}42