https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89134
Jiangning Liu <jiangning.liu at amperecomputing dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #2 from Jiangning Liu <jiangning.liu at amperecomputing dot com> ---
The original case is only a simple example, and what if GCC can figure out it
is NOT an infinite loop? For example,
std::map<KidsBook, BookEntry, comp> BookTable;
BookTable::iterator iter;
BookTable booktable;
for (iter = booktable.begin(); iter!=booktable.end(); ++iter) {
if (b) {
b = do_something();
}
}
Then GCC should be able to figure out this loop is a finite loop due to using
standard C++ STL std::map. The cost of iterating std::map might be high, so
we'd better consider optimize away the empty loop.