Skip to content

Change index variable name, simplify code #2435

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 8, 2018
Merged
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
13 changes: 5 additions & 8 deletions src/goto-programs/goto_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,12 @@ void goto_convertt::finish_gotos(goto_programt &dest, const irep_idt &mode)
// for C++ non-pod types and impossible in Java in any case.
auto goto_stack=g_it.second;
const auto &label_stack=l_it->second.second;
bool stack_is_prefix=true;
if(label_stack.size()>goto_stack.size())
stack_is_prefix=false;
for(std::size_t i=0, ilim=label_stack.size();
i!=ilim && stack_is_prefix;
++i)
bool stack_is_prefix = label_stack.size() <= goto_stack.size();
for(
std::size_t idx = 0, ilim = label_stack.size();
idx != ilim && stack_is_prefix; ++idx)
{
if(goto_stack[i]!=label_stack[i])
stack_is_prefix=false;
stack_is_prefix &= goto_stack[idx] == label_stack[idx];
}

if(!stack_is_prefix)
Expand Down