]> granicus.if.org Git - clang/commitdiff
[clang, test] Fix Clang :: Headers/max_align.c on 64-bit SPARC
authorRainer Orth <ro@gcc.gnu.org>
Tue, 23 Jul 2019 16:24:00 +0000 (16:24 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 23 Jul 2019 16:24:00 +0000 (16:24 +0000)
Clang :: Headers/max_align.c currently FAILs on 64-bit SPARC:

  error: 'error' diagnostics seen but not expected:
    File /vol/llvm/src/clang/dist/test/Headers/max_align.c Line 12: static_assert failed due to requirement '8 == _Alignof(max_align_t)' ""
  1 error generated.

This happens because SuitableAlign isn't defined for SPARCv9 unlike SPARCv8
(which uses the default of 64 bits).  gcc's sparc/sparc.h has

  #define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)

This patch sets SuitableAlign to match and updates the corresponding testcase.

Tested on sparcv9-sun-solaris2.11.

Differential Revision: https://reviews.llvm.org/D64487

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366820 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets/Sparc.h
test/Preprocessor/init.c

index 963192a4634fc282e8b32c3ff7d36a86b0599ede..1f799565e99b5ac43c83daefdd817461b8f6d660 100644 (file)
@@ -208,6 +208,7 @@ public:
     // aligned. The SPARCv9 SCD 2.4.1 says 16-byte aligned.
     LongDoubleWidth = 128;
     LongDoubleAlign = 128;
+    SuitableAlign = 128;
     LongDoubleFormat = &llvm::APFloat::IEEEquad();
     MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
   }
index 954f02a01434491729ea8111ad6dcdbbaad8c16c..6548a663d574e6c9c6c1531e46852c223b00f5d9 100644 (file)
 // X86-64-DECLSPEC: #define __declspec{{.*}}
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-none < /dev/null | FileCheck -match-full-lines -check-prefix SPARCV9 %s
+// SPARCV9:#define __BIGGEST_ALIGNMENT__ 16
 // SPARCV9:#define __INT64_TYPE__ long int
 // SPARCV9:#define __INTMAX_C_SUFFIX__ L
 // SPARCV9:#define __INTMAX_TYPE__ long int