From 6d70761e63221f6b0c035bbc2e3141afc9d6e9c6 Mon Sep 17 00:00:00 2001 From: risemeup1 <62429225+risemeup1@users.noreply.github.com> Date: Mon, 6 Feb 2023 10:32:40 +0800 Subject: [PATCH] fix gcc12 error: mismatched-new-delete error in custom_device.cc (#47466) --- paddle/phi/backends/custom/custom_device.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/paddle/phi/backends/custom/custom_device.cc b/paddle/phi/backends/custom/custom_device.cc index 164b425e39..a5a4e9b377 100644 --- a/paddle/phi/backends/custom/custom_device.cc +++ b/paddle/phi/backends/custom/custom_device.cc @@ -359,8 +359,7 @@ class CustomDevice : public DeviceInterface { } } else { if (!pimpl_->memory_copy_p2p) { - std::unique_ptr tmp( - reinterpret_cast(new uint8_t[size])); + std::unique_ptr tmp(new uint8_t[size]); MemoryCopyD2H(src_dev_id, tmp.get(), src, size); MemoryCopyH2D(dst_dev_id, dst, tmp.get(), size); } else { @@ -452,8 +451,7 @@ class CustomDevice : public DeviceInterface { PADDLE_ENFORCE_CUSTOM_DEVICE_SUCCESS( pimpl_->device_memory_set(device, ptr, value, size)); } else { - std::unique_ptr tmp( - reinterpret_cast(new uint8_t[size])); + std::unique_ptr tmp(new uint8_t[size]); memset(tmp.get(), value, size); MemoryCopyH2D(dev_id, ptr, tmp.get(), size); } -- GitLab