From 4ff57e5aba0e2d89c86ac896206750aa98c21f11 Mon Sep 17 00:00:00 2001 From: Michel Zou Date: Sat, 28 Aug 2021 13:45:40 +0200 Subject: [PATCH] zink: fix -Warray-bounds warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It would seems msvc and mingw dont pack across disparate types so zink_bind_rasterizer_state is too big for int32 string.h:202:10: warning: ‘__builtin___memcpy_chk’ forming offset [4, 7] is out of the bounds [0, 4] of object ‘rast_bits’ with type ‘uint32_t’ {aka ‘unsigned int’} [-Warray-bounds] 202 | return __builtin___memcpy_chk(__dst, __src, __n, __mingw_bos(__dst, 0)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/gallium/drivers/zink/zink_state.c: In function ‘zink_bind_rasterizer_state’: ../src/gallium/drivers/zink/zink_state.c:586:16: note: ‘rast_bits’ declared here Fixes: 9c5a2ab6 Acked-By: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/zink_state.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/zink_state.h b/src/gallium/drivers/zink/zink_state.h index 27011903fe4..2f3850e3c4d 100644 --- a/src/gallium/drivers/zink/zink_state.h +++ b/src/gallium/drivers/zink/zink_state.h @@ -70,12 +70,12 @@ struct zink_rasterizer_hw_state { unsigned polygon_mode : 2; //VkPolygonMode unsigned cull_mode : 2; //VkCullModeFlags unsigned line_mode : 2; //VkLineRasterizationModeEXT - bool depth_clamp:1; - bool rasterizer_discard:1; - bool pv_last:1; - bool line_stipple_enable:1; - bool force_persample_interp:1; - bool clip_halfz:1; + unsigned depth_clamp:1; + unsigned rasterizer_discard:1; + unsigned pv_last:1; + unsigned line_stipple_enable:1; + unsigned force_persample_interp:1; + unsigned clip_halfz:1; }; #define ZINK_RAST_HW_STATE_SIZE 12