test: byte-stream-buffer: Initialize data array

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 <niklas.soderlund@ragnatech.se>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2021-05-22 17:14:51 +02:00
parent 139d885574
commit 017f629fc7

View file

@ -20,7 +20,12 @@ class ByteStreamBufferTest : public Test
protected:
int run()
{
std::array<uint8_t, 100> 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<uint8_t, 100> data = {};
unsigned int i;
uint32_t value;
int ret;