diff --git a/paddle/fluid/memory/allocation/retry_allocator_test.cc b/paddle/fluid/memory/allocation/retry_allocator_test.cc index 670dc9ffba2e8fae4b84246eb35bd3f047b02693..11a8dfdc472d6b6cdec2b3f618aeb7065a10447b 100644 --- a/paddle/fluid/memory/allocation/retry_allocator_test.cc +++ b/paddle/fluid/memory/allocation/retry_allocator_test.cc @@ -127,7 +127,7 @@ TEST(RetryAllocator, RetryAllocatorLastAllocFailure) { { platform::CUDAPlace p(0); RetryAllocator allocator(std::make_shared(p), retry_ms); - size_t allocate_size = -1UL; // Very large number + size_t allocate_size = (static_cast(1) << 40); // Very large number try { auto allocation = allocator.Allocate(allocate_size); ASSERT_TRUE(false); diff --git a/paddle/fluid/memory/detail/system_allocator_test.cc b/paddle/fluid/memory/detail/system_allocator_test.cc index ed5022cac694368347d9990f17a81fdb2c84f301..34bb40d549dff1d711cd8924630cdf528f41ed76 100644 --- a/paddle/fluid/memory/detail/system_allocator_test.cc +++ b/paddle/fluid/memory/detail/system_allocator_test.cc @@ -73,7 +73,7 @@ TEST(CUDAPinnedAllocator, Alloc) { TEST(GPUAllocator, AllocFailure) { paddle::memory::detail::GPUAllocator allocator(0); size_t index; - size_t alloc_size = -1UL; // very large size + size_t alloc_size = (static_cast(1) << 40); // Very large number try { allocator.Alloc(&index, alloc_size); ASSERT_TRUE(false);