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

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Thu Mar 7 12:51:53 PST 2024


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

>From 50aff75ea4c306128c8a9001c3d4d2e2483fa0f7 Mon Sep 17 00:00:00 2001
From: Slava Zakharin <szakharin at nvidia.com>
Date: Thu, 7 Mar 2024 12:31:51 -0800
Subject: [PATCH] [flang] Fixed build issues after f20ea05.

Older versions of clang do not have __builtin_complex, but they
may define `__GNUC__`.
---
 flang/runtime/complex-reduction.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang/runtime/complex-reduction.c b/flang/runtime/complex-reduction.c
index 72c31ce08b875a..c91d1253991176 100644
--- a/flang/runtime/complex-reduction.c
+++ b/flang/runtime/complex-reduction.c
@@ -82,7 +82,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) {



More information about the flang-commits mailing list