Skip to content
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

[range_api] Fix bitwise shift rhs out-of-range #983

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions tests/range/range_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ void test_range_kernels(
const sycl::range<dims> range_two_const(range_two);
const sycl::range<dims> range_const(range);

// make sure bitwise shift rhs is smaller than number of bits in size_t.
sycl::range<dims> range_quarter(range / 4);
const sycl::range<dims> range_quarter_const(range_quarter);

// friend bool operator==(const T& lhs, const T& rhs)
INDEX_EQ_KERNEL_TEST(==, range, range_two);

Expand All @@ -62,8 +66,8 @@ void test_range_kernels(
INDEX_KERNEL_TEST(*, range, range_two_const, result);
INDEX_KERNEL_TEST(/, range, range_two_const, result);
INDEX_KERNEL_TEST(%, range, range_two_const, result);
INDEX_KERNEL_TEST(<<, range, range_two_const, result);
INDEX_KERNEL_TEST(>>, range, range_two_const, result);
INDEX_KERNEL_TEST(<<, range, range_quarter_const, result);
INDEX_KERNEL_TEST(>>, range, range_quarter_const, result);
INDEX_KERNEL_TEST(&, range, range_two_const, result);
INDEX_KERNEL_TEST(|, range, range_two_const, result);
INDEX_KERNEL_TEST(^, range, range_two_const, result);
Expand All @@ -81,8 +85,8 @@ void test_range_kernels(
DUAL_SIZE_INDEX_KERNEL_TEST(*, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(/, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(%, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(<<, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(>>, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(<<, range_quarter, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(>>, range_quarter, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(&, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(|, range, integer, result);
DUAL_SIZE_INDEX_KERNEL_TEST(^, range, integer, result);
Expand All @@ -99,8 +103,8 @@ void test_range_kernels(
INDEX_ASSIGNMENT_TESTS(*=, *, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(/=, /, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(%=, %, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(<<=, <<, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(>>=, >>, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(<<=, <<, range, range_quarter, result);
INDEX_ASSIGNMENT_TESTS(>>=, >>, range, range_quarter, result);
INDEX_ASSIGNMENT_TESTS(&=, &, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(|=, |, range, range_two, result);
INDEX_ASSIGNMENT_TESTS(^=, ^, range, range_two, result);
Expand All @@ -111,8 +115,8 @@ void test_range_kernels(
INDEX_ASSIGNMENT_INTEGER_TESTS(*=, *, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(/=, /, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(%=, %, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(<<=, <<, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(>>=, >>, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(<<=, <<, range_quarter, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(>>=, >>, range_quarter, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(&=, &, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(|=, |, range, integer, result);
INDEX_ASSIGNMENT_INTEGER_TESTS(^=, ^, range, integer, result);
Expand Down
Loading