This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 928d71efe2c2b4d8212f2b714acb941360c3fccd
Author: 神技圈子 <[email protected]>
AuthorDate: Sat Sep 9 00:30:11 2023 +0800

    [fix]Add  logging before _builtin_unreachable() (#24101)
    
    Co-authored-by: 宋光璠 <[email protected]>
---
 be/src/io/file_factory.h                                | 1 +
 be/src/pipeline/pipeline_task.h                         | 1 +
 be/src/runtime/memory/mem_tracker_limiter.h             | 1 +
 be/src/service/doris_main.cpp                           | 1 +
 be/src/util/binary_cast.hpp                             | 1 +
 be/src/util/expected.hpp                                | 1 +
 be/src/util/timezone_utils.cpp                          | 1 +
 be/src/vec/aggregate_functions/aggregate_function_map.h | 8 +++++++-
 be/src/vec/common/hash_table/hash_table.h               | 5 ++++-
 be/src/vec/common/hash_table/string_hash_table.h        | 1 +
 be/src/vec/core/types.h                                 | 1 +
 be/src/vec/data_types/data_type_decimal.h               | 1 +
 be/src/vec/data_types/data_type_number_base.cpp         | 1 +
 be/src/vec/data_types/data_type_number_base.h           | 1 +
 be/src/vec/data_types/serde/data_type_decimal_serde.h   | 1 +
 be/src/vec/functions/array/function_array_apply.cpp     | 1 +
 be/src/vec/functions/function_cast.h                    | 2 +-
 be/src/vec/functions/round.h                            | 8 ++++++--
 18 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/be/src/io/file_factory.h b/be/src/io/file_factory.h
index a311b8d58b..bb412a7d47 100644
--- a/be/src/io/file_factory.h
+++ b/be/src/io/file_factory.h
@@ -99,6 +99,7 @@ public:
         default:
             LOG(FATAL) << "not match type to convert, from type:" << type;
         }
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 };
diff --git a/be/src/pipeline/pipeline_task.h b/be/src/pipeline/pipeline_task.h
index 5e7b436202..27ca3cdd42 100644
--- a/be/src/pipeline/pipeline_task.h
+++ b/be/src/pipeline/pipeline_task.h
@@ -102,6 +102,7 @@ inline const char* get_state_name(PipelineTaskState idx) {
     case PipelineTaskState::BLOCKED_FOR_RF:
         return "BLOCKED_FOR_RF";
     }
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 
diff --git a/be/src/runtime/memory/mem_tracker_limiter.h 
b/be/src/runtime/memory/mem_tracker_limiter.h
index bf456c3455..144a189721 100644
--- a/be/src/runtime/memory/mem_tracker_limiter.h
+++ b/be/src/runtime/memory/mem_tracker_limiter.h
@@ -109,6 +109,7 @@ public:
         default:
             LOG(FATAL) << "not match type of mem tracker limiter :" << 
static_cast<int>(type);
         }
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
diff --git a/be/src/service/doris_main.cpp b/be/src/service/doris_main.cpp
index f7fb99caa8..bc32f50fe3 100644
--- a/be/src/service/doris_main.cpp
+++ b/be/src/service/doris_main.cpp
@@ -127,6 +127,7 @@ auto instruction_fail_to_string(InstructionFail fail) {
     case InstructionFail::ARM_NEON:
         ret("ARM_NEON");
     }
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 
diff --git a/be/src/util/binary_cast.hpp b/be/src/util/binary_cast.hpp
index b252c996c6..ecba899ec2 100644
--- a/be/src/util/binary_cast.hpp
+++ b/be/src/util/binary_cast.hpp
@@ -144,6 +144,7 @@ To binary_cast(From from) {
         conv.decimal = from;
         return conv.i128;
     } else {
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 }
diff --git a/be/src/util/expected.hpp b/be/src/util/expected.hpp
index 8ce7be05a5..6bb4693ca9 100644
--- a/be/src/util/expected.hpp
+++ b/be/src/util/expected.hpp
@@ -237,6 +237,7 @@ template <typename E>
 #ifdef _MSC_VER
   __assume(0);
 #else
+ LOG(FATAL) << "__builtin_unreachable";
   __builtin_unreachable();
 #endif
 #endif
diff --git a/be/src/util/timezone_utils.cpp b/be/src/util/timezone_utils.cpp
index 112dc74eb0..14dd8b7e53 100644
--- a/be/src/util/timezone_utils.cpp
+++ b/be/src/util/timezone_utils.cpp
@@ -98,6 +98,7 @@ T next_from_charstream(int8_t*& src) {
     } else {
         LOG(FATAL) << "Unknown endianess";
     }
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 
diff --git a/be/src/vec/aggregate_functions/aggregate_function_map.h 
b/be/src/vec/aggregate_functions/aggregate_function_map.h
index 057012f8b7..38b69756e0 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_map.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_map.h
@@ -40,7 +40,11 @@ template <typename K>
 struct AggregateFunctionMapAggData {
     using KeyType = std::conditional_t<std::is_same_v<K, String>, StringRef, 
K>;
     using Map = phmap::flat_hash_map<StringRef, int64_t>;
-    AggregateFunctionMapAggData() { __builtin_unreachable(); }
+
+    AggregateFunctionMapAggData() {
+        LOG(FATAL) << "__builtin_unreachable";
+        __builtin_unreachable();
+    }
 
     AggregateFunctionMapAggData(const DataTypes& argument_types) {
         _key_type = remove_nullable(argument_types[0]);
@@ -213,11 +217,13 @@ public:
 
     void serialize(ConstAggregateDataPtr /* __restrict place */,
                    BufferWritable& /* buf */) const override {
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
     void deserialize(AggregateDataPtr /* __restrict place */, BufferReadable& 
/* buf */,
                      Arena*) const override {
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
diff --git a/be/src/vec/common/hash_table/hash_table.h 
b/be/src/vec/common/hash_table/hash_table.h
index a460f0bc2a..756a2c9abb 100644
--- a/be/src/vec/common/hash_table/hash_table.h
+++ b/be/src/vec/common/hash_table/hash_table.h
@@ -379,7 +379,10 @@ struct HashTableFixedGrower {
     size_t next(size_t pos) const { return pos + 1; }
     bool overflow(size_t /*elems*/) const { return false; }
 
-    void increase_size() { __builtin_unreachable(); }
+    void increase_size() {
+        LOG(FATAL) << "__builtin_unreachable";
+        __builtin_unreachable();
+    }
     void set(size_t /*num_elems*/) {}
     void set_buf_size(size_t /*buf_size_*/) {}
 };
diff --git a/be/src/vec/common/hash_table/string_hash_table.h 
b/be/src/vec/common/hash_table/string_hash_table.h
index 712ccb3810..4311dddefd 100644
--- a/be/src/vec/common/hash_table/string_hash_table.h
+++ b/be/src/vec/common/hash_table/string_hash_table.h
@@ -309,6 +309,7 @@ protected:
                 return iterator4 == rhs.iterator4;
             }
             }
+            LOG(FATAL) << "__builtin_unreachable";
             __builtin_unreachable();
         }
 
diff --git a/be/src/vec/core/types.h b/be/src/vec/core/types.h
index 4bec3619d8..51fc436fe2 100644
--- a/be/src/vec/core/types.h
+++ b/be/src/vec/core/types.h
@@ -714,6 +714,7 @@ inline const char* getTypeName(TypeIndex idx) {
         return "Time";
     }
 
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 } // namespace vectorized
diff --git a/be/src/vec/data_types/data_type_decimal.h 
b/be/src/vec/data_types/data_type_decimal.h
index 138f277c3f..6d45063d47 100644
--- a/be/src/vec/data_types/data_type_decimal.h
+++ b/be/src/vec/data_types/data_type_decimal.h
@@ -190,6 +190,7 @@ public:
         if constexpr (std::is_same_v<TypeId<T>, TypeId<Decimal128I>>) {
             return TPrimitiveType::DECIMAL128I;
         }
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
diff --git a/be/src/vec/data_types/data_type_number_base.cpp 
b/be/src/vec/data_types/data_type_number_base.cpp
index 5e226b6c89..bd73fc4adc 100644
--- a/be/src/vec/data_types/data_type_number_base.cpp
+++ b/be/src/vec/data_types/data_type_number_base.cpp
@@ -136,6 +136,7 @@ Field DataTypeNumberBase<T>::get_field(const TExprNode& 
node) const {
     if constexpr (std::is_same_v<TypeId<T>, TypeId<Float64>>) {
         return Float64(node.float_literal.value);
     }
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 
diff --git a/be/src/vec/data_types/data_type_number_base.h 
b/be/src/vec/data_types/data_type_number_base.h
index 6ed8047f34..bf6aab8c21 100644
--- a/be/src/vec/data_types/data_type_number_base.h
+++ b/be/src/vec/data_types/data_type_number_base.h
@@ -114,6 +114,7 @@ public:
         if constexpr (std::is_same_v<TypeId<T>, TypeId<Float64>>) {
             return TPrimitiveType::DOUBLE;
         }
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
     Field get_default() const override;
diff --git a/be/src/vec/data_types/serde/data_type_decimal_serde.h 
b/be/src/vec/data_types/serde/data_type_decimal_serde.h
index 56a44e3561..e9565c7b69 100644
--- a/be/src/vec/data_types/serde/data_type_decimal_serde.h
+++ b/be/src/vec/data_types/serde/data_type_decimal_serde.h
@@ -60,6 +60,7 @@ public:
         if constexpr (std::is_same_v<TypeId<T>, TypeId<Decimal128>>) {
             return TYPE_DECIMALV2;
         }
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
diff --git a/be/src/vec/functions/array/function_array_apply.cpp 
b/be/src/vec/functions/array/function_array_apply.cpp
index a9de042e98..bc16ec6516 100644
--- a/be/src/vec/functions/array/function_array_apply.cpp
+++ b/be/src/vec/functions/array/function_array_apply.cpp
@@ -130,6 +130,7 @@ private:
         if constexpr (op == ApplyOp::GE) {
             return data >= comp;
         }
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
diff --git a/be/src/vec/functions/function_cast.h 
b/be/src/vec/functions/function_cast.h
index ed86e436a6..6a6a348e15 100644
--- a/be/src/vec/functions/function_cast.h
+++ b/be/src/vec/functions/function_cast.h
@@ -1036,7 +1036,7 @@ struct ToNumberMonotonicity {
                 return {};
             }
         }
-
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 };
diff --git a/be/src/vec/functions/round.h b/be/src/vec/functions/round.h
index 66753f00c0..ae79804022 100644
--- a/be/src/vec/functions/round.h
+++ b/be/src/vec/functions/round.h
@@ -112,7 +112,7 @@ struct IntegerRoundingComputation {
             return target_scale > 1 ? x * target_scale : x;
         }
         }
-
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
@@ -124,7 +124,7 @@ struct IntegerRoundingComputation {
         case ScaleMode::Negative:
             return compute_impl(x, scale, target_scale);
         }
-
+        LOG(FATAL) << "__builtin_unreachable";
         __builtin_unreachable();
     }
 
@@ -239,6 +239,7 @@ inline float roundWithMode(float x, RoundingMode mode) {
         return truncf(x);
     }
 
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 
@@ -254,6 +255,7 @@ inline double roundWithMode(double x, RoundingMode mode) {
         return trunc(x);
     }
 
+    LOG(FATAL) << "__builtin_unreachable";
     __builtin_unreachable();
 }
 
@@ -417,6 +419,7 @@ public:
         case 10000000000000000000ULL:
             return applyImpl<10000000000000000000ULL>(in, out);
         default:
+            LOG(FATAL) << "__builtin_unreachable";
             __builtin_unreachable();
         }
     }
@@ -474,6 +477,7 @@ struct Dispatcher {
 
             return col_res;
         } else {
+            LOG(FATAL) << "__builtin_unreachable";
             __builtin_unreachable();
             return nullptr;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to