Skip to content

Commit 5181be3

Browse files
committed
[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
1 parent 0e08891 commit 5181be3

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4054,6 +4054,9 @@ void Sema::AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
40544054
unsigned MaximumAlignment = Sema::MaximumAlignment;
40554055
if (Context.getTargetInfo().getTriple().isOSBinFormatCOFF())
40564056
MaximumAlignment = std::min(MaximumAlignment, 8192u);
4057+
else if (Context.getTargetInfo().getTriple().isOSAIX())
4058+
MaximumAlignment = std::min(MaximumAlignment, 4096u);
4059+
40574060
if (AlignVal > MaximumAlignment) {
40584061
Diag(AttrLoc, diag::err_attribute_aligned_too_great)
40594062
<< MaximumAlignment << E->getSourceRange();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang_cc1 -triple powerpc-unknown-aix -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -triple powerpc64-unknown-aix -fsyntax-only -verify %s
3+
//
4+
int a __attribute__((aligned(8192))); // expected-error {{requested alignment must be 4096 bytes or smaller}}

0 commit comments

Comments
 (0)