Skip to content

Commit

Permalink
Merge pull request #7852 from tautschnig/features/uninit-warning-gcc6
Browse files Browse the repository at this point in the history
Silence another spurious maybe-uninitialized warning
  • Loading branch information
kroening authored Aug 23, 2023
2 parents 79186c4 + b7054ba commit 88e7bfe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/util/lower_byte_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,14 @@ static exprt lower_byte_extract_array_vector(
if(num_elements.has_value())
{
exprt::operandst operands;
// Work around spurious GCC warning about num_elements being uninitialised.
#pragma GCC diagnostic push
#ifndef __clang__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
operands.reserve(*num_elements);
for(std::size_t i = 0; i < *num_elements; ++i)
#pragma GCC diagnostic pop
{
plus_exprt new_offset(
unpacked.offset(),
Expand Down

0 comments on commit 88e7bfe

Please sign in to comment.