From a0085a77edab452019a48d2d6f22b66c72fb1a6e Mon Sep 17 00:00:00 2001 From: risemeup1 <62429225+risemeup1@users.noreply.github.com> Date: Mon, 22 May 2023 19:25:04 +0800 Subject: [PATCH] fix gcc12 error of coverage_ci (#54009) --- paddle/phi/core/device_context.cc | 1 + paddle/phi/core/utils/array.h | 2 +- paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h | 2 +- paddle/phi/kernels/funcs/jit/more/intrinsic/layer_norm.cc | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/paddle/phi/core/device_context.cc b/paddle/phi/core/device_context.cc index cdbfb557039..1715c0965a7 100644 --- a/paddle/phi/core/device_context.cc +++ b/paddle/phi/core/device_context.cc @@ -297,6 +297,7 @@ struct DeviceContext::Impl { DeviceContext::DeviceContext() { impl_ = std::make_unique(); } DeviceContext::DeviceContext(const DeviceContext& other) { + impl_ = std::make_unique(); impl_->SetHostAllocator(&other.GetHostAllocator()); impl_->SetAllocator(&other.GetAllocator()); impl_->SetZeroAllocator(&other.GetZeroAllocator()); diff --git a/paddle/phi/core/utils/array.h b/paddle/phi/core/utils/array.h index b21e0bc088c..44290b73737 100644 --- a/paddle/phi/core/utils/array.h +++ b/paddle/phi/core/utils/array.h @@ -85,7 +85,7 @@ class Array { return ptr + i; } - T data_[N]; + T data_[N] = {}; }; template diff --git a/paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h b/paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h index e9ef8e31e44..e6d587a61e1 100644 --- a/paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h +++ b/paddle/phi/kernels/funcs/detail/gru_cpu_kernel.h @@ -130,7 +130,7 @@ void hl_avx_gru_forward_reset_output(OpResetOutput op_reset_output, #ifdef __AVX__ __m256 r_value_update_gate, r_value_update_gate_last = _mm256_set1_ps(0.0f); __m256 r_value_reset_gate, r_value_reset_gate_last = _mm256_set1_ps(0.0f); - __m256 r_value_reset_output; + __m256 r_value_reset_output = _mm256_setzero_ps(); __m256 r_prev_out = _mm256_set1_ps(0.0f), r_prev_out_last = _mm256_set1_ps(0.0f); __m256 r_reset_bias = _mm256_set1_ps(0.0f); diff --git a/paddle/phi/kernels/funcs/jit/more/intrinsic/layer_norm.cc b/paddle/phi/kernels/funcs/jit/more/intrinsic/layer_norm.cc index 54167261d1f..04f2cdf2697 100644 --- a/paddle/phi/kernels/funcs/jit/more/intrinsic/layer_norm.cc +++ b/paddle/phi/kernels/funcs/jit/more/intrinsic/layer_norm.cc @@ -43,7 +43,7 @@ void LayerNorm(float* x, __m256 sum; __m256 mean_vec, var_vec; __m128 hi, lo; - __m256 tmp; + __m256 tmp = _mm256_setzero_ps(); size_t offset; size_t j; __m256 reverse_num_vec = -- GitLab