-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warning in some user code when using std::memcpy #6000
Conversation
@@ -414,7 +414,7 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds, | |||
|
|||
// Copy functor (synchronously) to staging buffer in pinned host memory | |||
unsigned long *staging = hip_instance->constantMemHostStaging; | |||
std::memcpy(staging, &driver, sizeof(DriverType)); | |||
std::memcpy((void *)staging, (void *)&driver, sizeof(DriverType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use C++ casts and be const correct (as the C-style cast on &driver
isn't, although in this particular case it won't matter, as calling memcpy
will put the const
back on), as in
std::memcpy(static_cast<void*>(staging), static_cast<const void*>(&driver), sizeof(driver));
clang-format accident :) |
Please cherry-pick into 4.0.01 patch release |
Is this a problem in 3.7? I don't think so or? @Rombur Please cherry-pick to 4.0.01 |
Fix warning in some user code when using std::memcpy
It's not a problem in 3.7 |
This should fix the warning seen by user in #5998