mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[2/N] Enable UBSAN tests (#141740)
Apply c10::load in more places. The function was introduced to cast a byte to valid boolean values, thus fixing the UBSAN errors. Pull Request resolved: https://github.com/pytorch/pytorch/pull/141740 Approved by: https://github.com/ezyang
This commit is contained in:
@ -26,12 +26,12 @@ struct LoadImpl<bool> {
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
C10_HOST_DEVICE T load(const void* src) {
|
||||
C10_HOST_DEVICE constexpr T load(const void* src) {
|
||||
return c10::detail::LoadImpl<T>::apply(src);
|
||||
}
|
||||
|
||||
template <typename scalar_t>
|
||||
C10_HOST_DEVICE scalar_t load(const scalar_t* src) {
|
||||
C10_HOST_DEVICE constexpr scalar_t load(const scalar_t* src) {
|
||||
return c10::detail::LoadImpl<scalar_t>::apply(src);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user