diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4054,6 +4054,9 @@ unsigned MaximumAlignment = Sema::MaximumAlignment; if (Context.getTargetInfo().getTriple().isOSBinFormatCOFF()) MaximumAlignment = std::min(MaximumAlignment, 8192u); + else if (Context.getTargetInfo().getTriple().isOSAIX()) + MaximumAlignment = std::min(MaximumAlignment, 4096u); + if (AlignVal > MaximumAlignment) { Diag(AttrLoc, diag::err_attribute_aligned_too_great) << MaximumAlignment << E->getSourceRange(); diff --git a/clang/test/Sema/aix-attr-aligned-limit.c b/clang/test/Sema/aix-attr-aligned-limit.c new file mode 100644 --- /dev/null +++ b/clang/test/Sema/aix-attr-aligned-limit.c @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -triple powerpc-unknown-aix -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple powerpc64-unknown-aix -fsyntax-only -verify %s +// +int a __attribute__((aligned(8192))); // expected-error {{requested alignment must be 4096 bytes or smaller}}