[BUG]: UB in thrust tests caused by out-of range conversion from FP types to integers. #3021
Closed
1 task done
Labels
bug
Something isn't working right.
Is this a duplicate?
Type of Bug
Something else
Component
Thrust
Describe the bug
random_integers<fp-type>()
may generate values not representable as an integer type, which results in undefined behavior when we attempt to cast them to integer type later on.E.g.:
cccl/thrust/testing/for_each.cu
Lines 170 to 174 in 59deb06
UBsan reported an error on
(size_t)h_input[i]
:How to Reproduce
Stock thrust tests with clang, UBsan, and disabled optimizations.
Expected behavior
Avoiding undefined behavior is a good idea in general.
Reproduction link
No response
Operating System
No response
nvidia-smi output
No response
NVCC version
No response
The text was updated successfully, but these errors were encountered: