[flang-commits] [flang] [flang] Fixed build issues after f20ea05. (PR #84377)

via flang-commits flang-commits at lists.llvm.org
Thu Mar 7 12:40:05 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Slava Zakharin (vzakhari)

<details>
<summary>Changes</summary>

Older versions of clang do not have __builtin_complex, but they
may define `__GNUC__`.


---
Full diff: https://github.com/llvm/llvm-project/pull/84377.diff


1 Files Affected:

- (modified) flang/runtime/complex-reduction.c (+4-1) 


``````````diff
diff --git a/flang/runtime/complex-reduction.c b/flang/runtime/complex-reduction.c
index 72c31ce08b875a..574536badcf6bf 100644
--- a/flang/runtime/complex-reduction.c
+++ b/flang/runtime/complex-reduction.c
@@ -75,6 +75,7 @@ static long_double_Complex_t CMPLXL(long double r, long double i) {
 #endif
 #endif
 
+/* clang-format off */
 #if LDBL_MANT_DIG == 113 || HAS_FLOAT128
 #ifndef CMPLXF128
 /*
@@ -82,7 +83,8 @@ static long_double_Complex_t CMPLXL(long double r, long double i) {
  * supports __builtin_complex. For Clang, require >=12.0.
  * Otherwise, rely on the memory layout compatibility.
  */
-#if (defined(__clang_major__) && (__clang_major__ >= 12)) || defined(__GNUC__)
+#if (defined(__clang_major__) && (__clang_major__ >= 12)) ||
+    (defined(__GNUC__) && !defined(__clang__))
 #define CMPLXF128 __builtin_complex
 #else
 static CFloat128ComplexType CMPLXF128(CFloat128Type r, CFloat128Type i) {
@@ -154,3 +156,4 @@ ADAPT_REDUCTION(DotProductComplex10, long_double_Complex_t,
 ADAPT_REDUCTION(DotProductComplex16, CFloat128ComplexType, CppComplexFloat128,
     CMPLXF128, DOT_PRODUCT_ARGS, DOT_PRODUCT_ARG_NAMES)
 #endif
+    /* clang-format on */

``````````

</details>


https://github.com/llvm/llvm-project/pull/84377


More information about the flang-commits mailing list