https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89134
--- Comment #5 from Jiangning Liu <jiangning.liu at amperecomputing dot com> --- The loop below should be treated as a finite loop, for (iter = booktable.begin(); iter!=booktable.end(); ++iter) { ... } so there is a chance to optimize away the empty loop, in which do_something doesn't exist at all.