[flang-commits] [flang] 2716c6f - [flang] Tweak the conditions for the GCC 7/libstdc++ workaround

Martin Storsjö via flang-commits flang-commits at lists.llvm.org
Wed Jun 23 13:19:54 PDT 2021


Author: Martin Storsjö
Date: 2021-06-23T23:19:32+03:00
New Revision: 2716c6faa46f346b66fe7af5219d611b369d42e9

URL: https://github.com/llvm/llvm-project/commit/2716c6faa46f346b66fe7af5219d611b369d42e9
DIFF: https://github.com/llvm/llvm-project/commit/2716c6faa46f346b66fe7af5219d611b369d42e9.diff

LOG: [flang] Tweak the conditions for the GCC 7/libstdc++ workaround

This adjusts the workaround from D104731.

The issue lies in libstdc++'s classes, not GCC itself, and manifests
itself in the same way if building e.g. with clang while using
libstdc++ headers from GCC 7 (e.g. if building with Clang on Ubuntu 18.04,
while using the system default C++ library).

Therefore, change the condition to look for the version of libstdc++
instead of the compiler.

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

Added: 
    

Modified: 
    flang/include/flang/Evaluate/type.h

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Evaluate/type.h b/flang/include/flang/Evaluate/type.h
index 6ab09f60789d..a57d8107b7e3 100644
--- a/flang/include/flang/Evaluate/type.h
+++ b/flang/include/flang/Evaluate/type.h
@@ -142,7 +142,7 @@ class DynamicType {
     return charLengthParamValue_;
   }
   constexpr std::optional<std::int64_t> knownLength() const {
-#if !__clang__ && __GNUC__ == 7
+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE == 7
     if (knownLength_ < 0) {
       return std::nullopt;
     }
@@ -222,7 +222,7 @@ class DynamicType {
   TypeCategory category_{TypeCategory::Derived}; // overridable default
   int kind_{0};
   const semantics::ParamValue *charLengthParamValue_{nullptr};
-#if !__clang__ && __GNUC__ == 7
+#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE == 7
   // GCC 7's optional<> lacks a constexpr operator=
   std::int64_t knownLength_{-1};
 #else


        


More information about the flang-commits mailing list