[clang] 9a75c06 - [CUDA] Work around compatibility issue with libstdc++ 11.1.0

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon May 24 11:07:18 PDT 2021


Author: Artem Belevich
Date: 2021-05-24T11:07:09-07:00
New Revision: 9a75c06cd9d94d3fd13c47a01044da97b98cf26b

URL: https://github.com/llvm/llvm-project/commit/9a75c06cd9d94d3fd13c47a01044da97b98cf26b
DIFF: https://github.com/llvm/llvm-project/commit/9a75c06cd9d94d3fd13c47a01044da97b98cf26b.diff

LOG: [CUDA]  Work around compatibility issue with libstdc++ 11.1.0

libstdc++ redeclares __failed_assertion multiple times and that results in the
function declared with conflicting set of attributes when we include <complex>
with __host__ __device__ attributes force-applied to all functions.

In order to work around the issue, we rename __failed_assertion within the
region with forced attributes.

See https://bugs.llvm.org/show_bug.cgi?id=50383 for the details.

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

Added: 
    

Modified: 
    clang/lib/Headers/cuda_wrappers/complex

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/cuda_wrappers/complex b/clang/lib/Headers/cuda_wrappers/complex
index 11d40a82a8f6a..e6805b6044e98 100644
--- a/clang/lib/Headers/cuda_wrappers/complex
+++ b/clang/lib/Headers/cuda_wrappers/complex
@@ -72,8 +72,16 @@
 #define _GLIBCXX_USE_C99_COMPLEX 0
 #define _GLIBCXX_USE_C99_COMPLEX_TR1 0
 
+// Work around a compatibility issue with libstdc++ 11.1.0
+// https://bugs.llvm.org/show_bug.cgi?id=50383
+#pragma push_macro("__failed_assertion")
+#if _GLIBCXX_RELEASE == 11
+#define __failed_assertion __cuda_failed_assertion
+#endif
+
 #include_next <complex>
 
+#pragma pop_macro("__failed_assertion")
 #pragma pop_macro("_GLIBCXX_USE_C99_COMPLEX_TR1")
 #pragma pop_macro("_GLIBCXX_USE_C99_COMPLEX")
 


        


More information about the cfe-commits mailing list