diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2022-09-15 14:17:30 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-09-16 12:54:45 +0200 |
commit | 18c8fe97a7c6f0d8b239fd3ff8be252ad4a0b4a8 (patch) | |
tree | b38782a2abc8b1781aa300332c18510690ace3d0 | |
parent | b22219757a760010e3274c4e3564c9760230af03 (diff) | |
download | openvswitch-18c8fe97a7c6f0d8b239fd3ff8be252ad4a0b4a8.tar.gz |
test-list: Fix false-positive build failure with GCC 12.
GCC 12.2.1 on Fedora 36 generates the following false-positive
warning that is treated as error with -Werror:
tests/test-list.c: In function 'test_list_construction':
tests/test-list.c:110:9: error: 'values' may be used uninitialized
110 | check_list(&list, values, n);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
For some reason it fails to recognize that array will not
be used if 'n' equals zero.
Fix that by just initializing arrays in full before using,
since it's just a test code.
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | tests/test-list.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test-list.c b/tests/test-list.c index 648e02a5e..d1dbde30a 100644 --- a/tests/test-list.c +++ b/tests/test-list.c @@ -106,6 +106,8 @@ test_list_construction(void) int values[MAX_ELEMS]; struct ovs_list list; + memset(elements, 0, sizeof elements); + memset(values, 0, sizeof values); make_list(&list, elements, values, n); check_list(&list, values, n); } |