Fix Build Warnings for AArch64 (#2242)

This commit links to issue (#2234).

When cross-compiling for AArch64, using gcc 13.3, you encounter three
warnings types that turn into errors:

- maybe-uninitialized
- stringop-truncation
- strict-aliasing

This commit fixes all the warnings found, in regards to the first two
rules. To resolve the warnigns due to strict-aliasing, I am editing the
CMake build system.

Signed-off-by: Antonios Christidis <a-christidis@ti.com>
This commit is contained in:
Antonios Christidis
2025-02-05 06:58:17 -06:00
committed by GitHub
parent bcfa1f7c26
commit 2031e21a58
30 changed files with 104 additions and 43 deletions

View File

@@ -261,14 +261,18 @@ static cl_program makeSelectProgram(cl_kernel *kernel_ptr,
switch( vec_len )
{
case 1:
strncpy(stypename, type_name[srctype], sizeof(stypename));
strncpy(ctypename, type_name[cmptype], sizeof(ctypename));
strncpy(stypename, type_name[srctype], sizeof(stypename) - 1);
stypename[sizeof(stypename) - 1] = '\0';
strncpy(ctypename, type_name[cmptype], sizeof(ctypename) - 1);
ctypename[sizeof(ctypename) - 1] = '\0';
snprintf(testname, sizeof(testname), "select_%s_%s", stypename, ctypename );
log_info("Building %s(%s, %s, %s)\n", testname, stypename, stypename, ctypename);
break;
case 3:
strncpy(stypename, type_name[srctype], sizeof(stypename));
strncpy(ctypename, type_name[cmptype], sizeof(ctypename));
strncpy(stypename, type_name[srctype], sizeof(stypename) - 1);
stypename[sizeof(stypename) - 1] = '\0';
strncpy(ctypename, type_name[cmptype], sizeof(ctypename) - 1);
ctypename[sizeof(ctypename) - 1] = '\0';
snprintf(testname, sizeof(testname), "select_%s3_%s3", stypename, ctypename );
log_info("Building %s(%s3, %s3, %s3)\n", testname, stypename, stypename, ctypename);
break;