From b99986a35adad8e632bd408a2ae33a5b5c0119f8 Mon Sep 17 00:00:00 2001 From: hong19860320 <9973393+hong19860320@users.noreply.github.com> Date: Mon, 27 Apr 2020 10:10:06 +0800 Subject: [PATCH] [Core] Fix stack overflow in STL::ostream (#3503) --- lite/api/paddle_place.cc | 1 + lite/core/op_registry.h | 3 +++ lite/utils/replace_stl/stream.cc | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lite/api/paddle_place.cc b/lite/api/paddle_place.cc index 3cef9563d8..cb70fd43cd 100644 --- a/lite/api/paddle_place.cc +++ b/lite/api/paddle_place.cc @@ -161,6 +161,7 @@ std::set ExpandValidTargets(TargetType target) { TARGET(kBM), TARGET(kMLU), TARGET(kAPU), + TARGET(kRKNPU), TARGET(kFPGA)}); if (target == TARGET(kAny)) { return valid_set; diff --git a/lite/core/op_registry.h b/lite/core/op_registry.h index 7c2df12b17..5b58fd2bb9 100644 --- a/lite/core/op_registry.h +++ b/lite/core/op_registry.h @@ -260,6 +260,9 @@ class KernelRegistry final { KernelRegistryForTarget *, // + KernelRegistryForTarget *, // KernelRegistryForTarget *, // diff --git a/lite/utils/replace_stl/stream.cc b/lite/utils/replace_stl/stream.cc index 37b02d3c50..3c1cd2573c 100644 --- a/lite/utils/replace_stl/stream.cc +++ b/lite/utils/replace_stl/stream.cc @@ -40,9 +40,9 @@ void ostream::pad(const std::string& text) { #ifdef LITE_SHUTDOWN_LOG #define ADD_DATA_AS_STRING(data_, obj_) #else -#define ADD_DATA_AS_STRING(data_, obj_) \ - std::string text = paddle::lite::to_string(obj_); \ - pad(text); \ +#define ADD_DATA_AS_STRING(data_, obj_) \ + std::string text = std::to_string(obj_); \ + pad(text); \ data_ = data_ + text; #endif -- GitLab