From 96cd4cc9540e68b31e833ea8d891ff0a543199d9 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Thu, 5 Jun 2025 18:23:38 -0400 Subject: [PATCH] vkd3d-shader/ir: Avoid a compiler warning in vsir_block_list_init(). The following warning appears during compilation with gcc 15.1.1 20250425: In function 'vsir_block_list_init', inlined from 'vsir_block_init' at vkd3d/libs/vkd3d-shader/ir.c:3821:5, inlined from 'vsir_cfg_init' at vkd3d/libs/vkd3d-shader/ir.c:4285:28: vkd3d/libs/vkd3d-shader/ir.c:3758:5: warning: 'memset' writing 24 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=] 3758 | memset(list, 0, sizeof(*list)); | ^ In function 'vsir_cfg_init': lto1: note: destination object is likely at address zero looking at the code in vsir_cfg_init() this seems like an spurious warning. Looking on the internet, these bogus warnings with memset() seem to be a common occurrence. memset() is replaced with a zero value assignment to avoid this. --- libs/vkd3d-shader/ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index a7a5c808c..2a26c88cb 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -4369,7 +4369,7 @@ struct vsir_block_list static void vsir_block_list_init(struct vsir_block_list *list) { - memset(list, 0, sizeof(*list)); + *list = (struct vsir_block_list){0}; } static void vsir_block_list_cleanup(struct vsir_block_list *list)