Skip to content

Work around further spurious GCC12 maybe-uninitialized warnings #7797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/goto-instrument/unwindset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ void unwindsett::parse_unwindset_one_loop(
if(val.empty())
return;

// Work around spurious GCC 12 warning about thread_nr being uninitialised.
#pragma GCC diagnostic push
#ifndef __clang__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
optionalt<unsigned> thread_nr;
#pragma GCC diagnostic pop
if(isdigit(val[0]))
{
auto c_pos = val.find(':');
Expand Down Expand Up @@ -157,7 +163,13 @@ void unwindsett::parse_unwindset_one_loop(
return;
}
else
// Work around spurious GCC 12 warning about thread_nr being uninitialised.
#pragma GCC diagnostic push
#ifndef __clang__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
id = function_id + "." + std::to_string(*nr);
#pragma GCC diagnostic pop
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/util/cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,13 @@ bool cmdlinet::parse_arguments(int argc, const char **argv)
return true;
}

// Work around spurious GCC 12 warning about optnr being uninitialised.
#pragma GCC diagnostic push
#ifndef __clang__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
options[*optnr].isset = true;
#pragma GCC diagnostic pop

if(options[*optnr].hasval)
{
Expand Down
7 changes: 7 additions & 0 deletions src/util/simplify_expr_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ static bool mul_expr(
return true;
}

// Work around spurious GCC 12 warning about c_sizeof_type being
// uninitialised in its destructor (!).
#pragma GCC diagnostic push
#ifndef __clang__
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
simplify_exprt::resultt<> simplify_exprt::simplify_mult(const mult_exprt &expr)
{
// check to see if it is a number type
Expand Down Expand Up @@ -270,6 +276,7 @@ simplify_exprt::resultt<> simplify_exprt::simplify_mult(const mult_exprt &expr)
return std::move(tmp);
}
}
#pragma GCC diagnostic pop

simplify_exprt::resultt<> simplify_exprt::simplify_div(const div_exprt &expr)
{
Expand Down