Skip to content

Commit ddc163a

Browse files
authored
Fix conversion data loss in test api min max constant buffer size (#1359)
It fix issue when bigger sizes above UINT_MAX are reported. Then test works and display results incorrectly.
1 parent be530df commit ddc163a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

test_conformance/api/test_api_min_max.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ REGISTER_TEST(min_max_constant_buffer_size)
15261526
size_t threads[1], localThreads[1];
15271527
cl_int *constantData, *resultData;
15281528
cl_ulong maxSize, stepSize, currentSize, maxGlobalSize, maxAllocSize;
1529-
int i;
1529+
size_t i;
15301530
cl_event event;
15311531
cl_int event_status;
15321532
MTdata d;
@@ -1556,6 +1556,8 @@ REGISTER_TEST(min_max_constant_buffer_size)
15561556

15571557
maxAllocSize = get_device_info_max_mem_alloc_size(
15581558
device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
1559+
log_info("Reported max alloc size of %" PRIu64 " bytes.\n",
1560+
(uint64_t)maxAllocSize);
15591561

15601562
if (maxSize > maxAllocSize) maxSize = maxAllocSize;
15611563

@@ -1590,7 +1592,7 @@ REGISTER_TEST(min_max_constant_buffer_size)
15901592
return EXIT_FAILURE;
15911593
}
15921594

1593-
for (i = 0; i < (int)(numberOfInts); i++)
1595+
for (i = 0; i < numberOfInts; i++)
15941596
constantData[i] = (int)genrand_int32(d);
15951597

15961598
clMemWrapper streams[3];
@@ -1678,11 +1680,11 @@ REGISTER_TEST(min_max_constant_buffer_size)
16781680
sizeToAllocate, resultData, 0, NULL, NULL);
16791681
test_error(error, "clEnqueueReadBuffer failed");
16801682

1681-
for (i = 0; i < (int)(numberOfInts); i++)
1683+
for (i = 0; i < numberOfInts; i++)
16821684
if (constantData[i] != resultData[i])
16831685
{
1684-
log_error("Data failed to verify: constantData[%d]=%d != "
1685-
"resultData[%d]=%d\n",
1686+
log_error("Data failed to verify: constantData[%zu]=%d != "
1687+
"resultData[%zu]=%d\n",
16861688
i, constantData[i], i, resultData[i]);
16871689
free(constantData);
16881690
free(resultData);

0 commit comments

Comments
 (0)