From 017f629fc775629dd22422da6d73325b4bc396d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sat, 22 May 2021 17:14:51 +0200 Subject: test: byte-stream-buffer: Initialize data array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compiler warning about variable use before being initialized that appears with gcc 11.1.0. test/byte-stream-buffer.cpp:31:63: error: ‘data’ may be used uninitialized [-Werror=maybe-uninitialized] Signed-off-by: Niklas Söderlund Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- test/byte-stream-buffer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/byte-stream-buffer.cpp b/test/byte-stream-buffer.cpp index d606f146..04ff0571 100644 --- a/test/byte-stream-buffer.cpp +++ b/test/byte-stream-buffer.cpp @@ -20,7 +20,12 @@ class ByteStreamBufferTest : public Test protected: int run() { - std::array data; + /* + * gcc 11.1.0 incorrectly raises a maybe-uninitialized warning + * when calling data.size() below (if the address sanitizer is + * disabled). Silence it by initializing the array. + */ + std::array data = {}; unsigned int i; uint32_t value; int ret; -- cgit v1.2.1