[PATCH vkd3d 2/2] tests: Avoid -Wstringop-overread warnings from GCC 11.1+.
Henri Verbeet
hverbeet at gmail.com
Thu Jan 13 10:18:18 CST 2022
On Mon, 10 Jan 2022 at 15:01, Conor McCarthy <cmccarthy at codeweavers.com> wrote:
> @@ -5703,7 +5703,7 @@ static void test_unknown_rtv_format(void)
> create_render_target(&context, &desc, &render_targets[1], &rtvs[2]);
>
> for (i = 0; i < ARRAY_SIZE(rtvs); ++i)
> - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtvs[i], &white.x, 0, NULL);
> + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtvs[i], (const float *)&white, 0, NULL);
>
> /* NULL RTV */
> memset(&rtv_desc, 0, sizeof(rtv_desc));
> @@ -14086,7 +14086,7 @@ static void test_gather(void)
> {0.3f, 1.3f, 1.2f, 0.2f}, {1.3f, 2.3f, 2.2f, 1.2f}, {2.3f, 3.3f, 3.2f, 2.2f}, {3.3f, 3.3f, 3.2f, 3.2f},
> {0.3f, 1.3f, 1.3f, 0.3f}, {1.3f, 2.3f, 2.3f, 1.3f}, {2.3f, 3.3f, 3.3f, 2.3f}, {3.3f, 3.3f, 3.3f, 3.3f},
> };
> - static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f};
> + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
> static const D3D12_SUBRESOURCE_DATA resource_data = {&texture_data, sizeof(texture_data) / 4};
>
> memset(&desc, 0, sizeof(desc));
> @@ -14123,7 +14123,7 @@ static void test_gather(void)
> context.pipeline_state = create_pipeline_state(context.device,
> context.root_signature, desc.rt_format, NULL, &ps_gather4, NULL);
>
> - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL);
> + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
>
> ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL);
> ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
Note that you're using two different approaches above. I'm not
particularly fond of either one, but I think I prefer keeping the
struct vec4 and adding a cast over changing these to plain arrays. It
may also be worth considering making struct vec4 a union of an array
and the individual fields, although that's not without its drawbacks
either.
More information about the wine-devel
mailing list