Skip to content

Commit

Permalink
Disable false-alarm gcc warning
Browse files Browse the repository at this point in the history
  • Loading branch information
seelabs authored and manojsdoshi committed Jul 27, 2021
1 parent 8b58e93 commit 78bc272
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ripple/beast/utility/rngfill.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ rngfill(void* buffer, std::size_t bytes, Generator& g)
buffer = reinterpret_cast<std::uint8_t*>(buffer) + sizeof(v);
bytes -= sizeof(v);
}
#ifdef __GNUC__
// gcc 11.1 (falsely) warns about an array-bounds overflow in release mode.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
if (bytes > 0)
{
auto const v = g();
std::memcpy(buffer, &v, bytes);
}
#pragma GCC diagnostic pop
#endif
}

template <
Expand Down

0 comments on commit 78bc272

Please sign in to comment.