https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108860
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs-bisection | See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=109442 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I still see the warnings on gcc-14, but not on trunk. Fixed on trunk by Honza's r15-5361-gaac5c57ee16723 Add __builtion_unreachable to vector::size(), vector::capacity() This patch makes it clear that vector sizes and capacities are not negative. With recent change to ipa-fnsummary this should not affect inlining and improves codegen of some vector manipulation functions. I tested clang build. Looking for throw_bad calls there are only 3 called considerably often (bad_allloc, bad_array_new_length and function_callv). The patch seems to reduce bad_alloc and bad_array_new_length calls considerably: bad_alloc 380->147 bad_array_new_length 832->128 libstdc++-v3/ChangeLog: PR tree-optimization/109442 * include/bits/stl_vector.h: (vector::size(), vector::capacity()): Add __builtin_unreachable call to announce that size and capacity are non-negative.