diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2021-05-22 17:14:51 +0200 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2021-05-26 10:24:15 +0200 |
commit | 017f629fc775629dd22422da6d73325b4bc396d7 (patch) | |
tree | 91115eccfafa2f5b1d0c53e377568047ac2c5a90 | |
parent | 139d8855747799da9218f36720004fb1927bd2ef (diff) |
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>
-rw-r--r-- | test/byte-stream-buffer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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<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; |