Author: Sean Fertile Date: 2021-08-05T09:51:16-04:00 New Revision: 5181be344adbf7ba7dffc73526893d4e7750d34c
URL: https://github.com/llvm/llvm-project/commit/5181be344adbf7ba7dffc73526893d4e7750d34c DIFF: https://github.com/llvm/llvm-project/commit/5181be344adbf7ba7dffc73526893d4e7750d34c.diff LOG: [PowerPC][AIX] Limit attribute aligned to 4096. Limit the maximum alignment for attribute aligned to 4096 to match the limit of the .align pseudo op in the system assembler. Differential Revision: https://reviews.llvm.org/D107497 Added: clang/test/Sema/aix-attr-aligned-limit.c Modified: clang/lib/Sema/SemaDeclAttr.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 5cc5e5fb24413..e5d03d55a5d6f 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -4054,6 +4054,9 @@ void Sema::AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, 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 index 0000000000000..3c9a0facf9e54 --- /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}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits