From ddc163a03ae010eb3f3eb6162f7b70132d104544 Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Tue, 17 Feb 2026 19:27:36 +0100 Subject: [PATCH] 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. --- test_conformance/api/test_api_min_max.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test_conformance/api/test_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index 29677623..fd8c3ee5 100644 --- a/test_conformance/api/test_api_min_max.cpp +++ b/test_conformance/api/test_api_min_max.cpp @@ -1526,7 +1526,7 @@ REGISTER_TEST(min_max_constant_buffer_size) size_t threads[1], localThreads[1]; cl_int *constantData, *resultData; cl_ulong maxSize, stepSize, currentSize, maxGlobalSize, maxAllocSize; - int i; + size_t i; cl_event event; cl_int event_status; MTdata d; @@ -1556,6 +1556,8 @@ REGISTER_TEST(min_max_constant_buffer_size) maxAllocSize = get_device_info_max_mem_alloc_size( device, MAX_DEVICE_MEMORY_SIZE_DIVISOR); + log_info("Reported max alloc size of %" PRIu64 " bytes.\n", + (uint64_t)maxAllocSize); if (maxSize > maxAllocSize) maxSize = maxAllocSize; @@ -1590,7 +1592,7 @@ REGISTER_TEST(min_max_constant_buffer_size) return EXIT_FAILURE; } - for (i = 0; i < (int)(numberOfInts); i++) + for (i = 0; i < numberOfInts; i++) constantData[i] = (int)genrand_int32(d); clMemWrapper streams[3]; @@ -1678,11 +1680,11 @@ REGISTER_TEST(min_max_constant_buffer_size) sizeToAllocate, resultData, 0, NULL, NULL); test_error(error, "clEnqueueReadBuffer failed"); - for (i = 0; i < (int)(numberOfInts); i++) + for (i = 0; i < numberOfInts; i++) if (constantData[i] != resultData[i]) { - log_error("Data failed to verify: constantData[%d]=%d != " - "resultData[%d]=%d\n", + log_error("Data failed to verify: constantData[%zu]=%d != " + "resultData[%zu]=%d\n", i, constantData[i], i, resultData[i]); free(constantData); free(resultData);