https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107699
Hans-Peter Nilsson <hp at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hp at gcc dot gnu.org --- Comment #3 from Hans-Peter Nilsson <hp at gcc dot gnu.org> --- (In reply to Carlos Galvez from comment #2) > Since the __last iterator cannot be known at compile time, this "if" branch > must be generated by the compiler. But then std::sort has hardcoded this > _S_threshold = 16, and computes a pointer __first + 16, which is known to be > OOB. > > The question is: should the compiler *really* warn in this type of code, in > -Wall, which is the bare-minimum warning level for all projects? All analysis of the actual test-case aside, from the setting of "NEW" and "last confirmed" of the bugzilla entry, the answer is clearly "no". ;-) I'm not sure it happened this time, but sometimes reporters misinterpret gcc-folks comments about the bug, to be comments related to the validity of their test-case, when it's about what gcc did wrong.