From a871c42e39052d8dfd8cd6d661bb9ada5c09486c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 7 Feb 2026 22:02:23 -0800 Subject: [PATCH] compiler/clc: Fix const correctness in libclc_add_generic_variants Fix compiler error: ../src/compiler/clc/nir_load_libclc.c:266:13: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 266 | char *U3AS1 = strstr(func->name, "U3AS1"); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ glibc now provides C23-style type-generic string functions. strstr returns const char * when passed a const char * argument. Update U3AS1 declaration to const since it's only used for offset calculation. Fixes: 4a08ee7ecf0 ("spirv/libclc: Add generic versions of arithmetic functions") Signed-off-by: Vinson Lee Reviewed-by: Karol Herbst (cherry picked from commit 85fd63068e91d0dd4b9434831ddddbbc2ff07355) Part-of: --- .pick_status.json | 2 +- src/compiler/clc/nir_load_libclc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5081e4386e5..6f445e5637a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1334,7 +1334,7 @@ "description": "compiler/clc: Fix const correctness in libclc_add_generic_variants", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4a08ee7ecf07b1d0cdfec4f61bdca08bf6551247", "notes": null diff --git a/src/compiler/clc/nir_load_libclc.c b/src/compiler/clc/nir_load_libclc.c index 8c51aaf776d..48668eaec0f 100644 --- a/src/compiler/clc/nir_load_libclc.c +++ b/src/compiler/clc/nir_load_libclc.c @@ -263,7 +263,7 @@ libclc_add_generic_variants(nir_shader *shader) if (strstr(func->name, "async_work_group_strided_copy")) continue; - char *U3AS1 = strstr(func->name, "U3AS1"); + const char *U3AS1 = strstr(func->name, "U3AS1"); if (U3AS1 == NULL) continue;