Skip to content

Commit

Permalink
avoid bogus GCC warning in Topo::apply_all_restraints
Browse files Browse the repository at this point in the history
-Wstringop-overflow was triggered from vector::insert,
similarly to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366

Spotted after upgrading to Ubuntu 24.04 with GCC 14
  • Loading branch information
wojdyr committed Sep 5, 2024
1 parent c810526 commit 1077566
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/topo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ void Topo::apply_all_restraints(const MonLib& monlib) {
while (++it != ri.chemcomps.end()) {
auto rules = apply_restraints(it->cc->rt, *ri.res, nullptr, Asu::Same,
it->altloc, '\0', /*require_alt=*/true);
// calling reserve avoids bogus GCC warning -Wstringop-overflow
ri.monomer_rules.reserve(ri.monomer_rules.size() + rules.size());
vector_move_extend(ri.monomer_rules, std::move(rules));
}
}
Expand Down

0 comments on commit 1077566

Please sign in to comment.