From 67875adcba752bc7b44225c6d2decebfd3081322 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 285507cbd48..11afd70f198 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1244,7 +1244,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 c4784350296..869db0c7533 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;