From 9f992dd85ec7001f47491684738ee7c072ada382 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 4 Apr 2024 09:09:48 +0200 Subject: [PATCH] dcb: fix test compilation GCC 14 with LTO generates the following warning: src/core/tests/test-dcb.c: In function 'test_dcb_cleanup': src/core/tests/test-dcb.c:283:5: error: array subscript _3 is outside array bounds of 'const char *[0:]' [-Werror=array-bounds=] 283 | g_assert_cmpstr(expected.cmds[expected.num], ==, NULL); | ^ src/core/tests/test-dcb.c:14:17: note: while referencing 'cmds' 14 | const char *cmds[]; | ^ src/core/tests/test-dcb.c:261:24: note: defined here 'expected' 261 | static DcbExpected expected = { | ^ Define the commands as a fixed array instead of flexible array member. (cherry picked from commit 9ff7ff28fc15f0e34f6f30cbed63907f7b39b46f) --- src/core/tests/test-dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/tests/test-dcb.c b/src/core/tests/test-dcb.c index f85e90f990..33437974d5 100644 --- a/src/core/tests/test-dcb.c +++ b/src/core/tests/test-dcb.c @@ -11,7 +11,7 @@ typedef struct { guint num; - const char *cmds[]; + const char *cmds[16]; } DcbExpected; static gboolean