Skip to content

Commit fea1719

Browse files
IlanTruanovskypcolberg
authored andcommitted
Fix Coverity issues for acl_hal_test.cpp
Fixes: ``` test/acl_hal_test.cpp:394:69: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_hal_test.cpp:394:69: invalid_type: Argument "size" to format specifier "%d" was expected to have type "int" but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] test/acl_hal_test.cpp:666:42: Type: Invalid type in argument to printf format specifier (PRINTF_ARGS) test/acl_hal_test.cpp:666:42: invalid_type: Argument "max_dev_addr" to format specifier "%p" was expected to have pointer type but has type "unsigned long". src/acl_hal.cpp:123:3: path: Condition "debug_mode > 0", taking true branch. src/acl_hal.cpp:126:5: printf_function: Calling "vprintf" which uses a "printf"-style format string. [Note: The source code implementation of the function has been overridden by a builtin model.] ```
1 parent 4ba0a9a commit fea1719

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/acl_hal_test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <CL/opencl.h>
1414

15+
#include <cinttypes>
1516
#include <stdarg.h>
1617
#include <stdio.h>
1718

@@ -391,7 +392,7 @@ void acltest_hal_copy_hostmem_to_hostmem(cl_event event, const void *src,
391392
acltest_hal_event_callback(
392393
event, CL_RUNNING); // in "real life" this in response to a hw message
393394
size_t i;
394-
acl_print_debug_msg(" Copying %d bytes from %p to %p event %p\n", size, src,
395+
acl_print_debug_msg(" Copying %zu bytes from %p to %p event %p\n", size, src,
395396
dest, event);
396397
for (i = 0; i < size; i++) {
397398
((char *)dest)[i] = ((char *)src)[i];
@@ -663,7 +664,7 @@ void *acltest_translate_device_address(const void *device_ptr, size_t offset) {
663664
}
664665

665666
uintptr_t max_dev_addr = 0xfffffff & ((uintptr_t)device_ptr + offset);
666-
acl_print_debug_msg("maxdevaddr %p\n", max_dev_addr);
667+
acl_print_debug_msg("maxdevaddr %" PRIuPTR "\n", max_dev_addr);
667668
if (!acltest_hal_device_mem || max_dev_addr >= acltest_hal_device_mem_size) {
668669
if (!acltest_hal_device_mem) {
669670
acltest_hal_device_mem = acl_malloc(max_dev_addr + 1);

0 commit comments

Comments
 (0)