[PATCH] D107497: [PowerPC][AIX] Limit attribute aligned to 4096.

Sean Fertile via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 4 15:12:41 PDT 2021


sfertile updated this revision to Diff 364264.
sfertile added a comment.

Fix formatting.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107497/new/

https://reviews.llvm.org/D107497

Files:
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/Sema/aix-attr-aligned-limit.c


Index: clang/test/Sema/aix-attr-aligned-limit.c
===================================================================
--- /dev/null
+++ 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}}
Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ 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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107497.364264.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210804/3c85fdc4/attachment-0001.bin>


More information about the cfe-commits mailing list