Skip to content

Commit 0a282f5

Browse files
committed
Avoid OOB access in backend_tests for platforms with no devices
1 parent 9d69668 commit 0a282f5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

test/backend_tests.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ struct host_or_device {
9696

9797
std::pair<host_or_device, host_or_device> select_source_and_target(const copy_test_type test_type, const sycl::platform& platform) {
9898
const auto devices = platform.get_devices();
99+
if(devices.empty()) { throw std::runtime_error(fmt::format("Platform {} has no devices", platform.get_info<sycl::info::platform::name>())); }
99100
switch(test_type) {
100101
case copy_test_type::intra_device: {
101102
return std::pair{host_or_device{sycl::queue{devices[0]}}, host_or_device{sycl::queue{devices[0]}}};

0 commit comments

Comments
 (0)