Skip to content

Commit

Permalink
Fix uninitialized memory in test code.
Browse files Browse the repository at this point in the history
The `CanWriteExplicitlySizedEnumSizes` test can fail on some
compilers/configurations due to `buffer` being uninitialized.
  • Loading branch information
reventlov committed Aug 29, 2022
1 parent a761f62 commit b27fd7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/back_end/cpp/testcode/uint_sizes_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ TEST(SizesView, CanReadExplicitlySizedEnumSizes) {
}

TEST(SizesWriter, CanWriteExplicitlySizedEnumSizes) {
::std::uint8_t buffer[sizeof kExplicitlySizedEnumSizes];
::std::uint8_t buffer[sizeof kExplicitlySizedEnumSizes] = {0};
auto writer = ExplicitlySizedEnumSizesWriter(buffer, sizeof buffer);
writer.one_byte().Write(ExplicitlySizedEnum::VALUE1);
writer.two_byte().Write(ExplicitlySizedEnum::VALUE10);
Expand Down

0 comments on commit b27fd7a

Please sign in to comment.