diff options
author | Sean Fertile <sd.fertile@gmail.com> | 2021-08-05 09:46:58 -0400 |
---|---|---|
committer | Sean Fertile <sd.fertile@gmail.com> | 2021-08-05 09:51:16 -0400 |
commit | 5181be344adbf7ba7dffc73526893d4e7750d34c (patch) | |
tree | ac3204b6ebc172105d26044d35adccca764f9dd3 | |
parent | 0e08891ec1a63850c99cfe270ae5370150a12d29 (diff) | |
download | llvm-5181be344adbf7ba7dffc73526893d4e7750d34c.zip llvm-5181be344adbf7ba7dffc73526893d4e7750d34c.tar.gz llvm-5181be344adbf7ba7dffc73526893d4e7750d34c.tar.bz2 |
[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
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 3 | ||||
-rw-r--r-- | clang/test/Sema/aix-attr-aligned-limit.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 5cc5e5f..e5d03d5 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 0000000..3c9a0fa --- /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}} |