https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89337
Tobias Schlüter <tobi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tobi at gcc dot gnu.org --- Comment #13 from Tobias Schlüter <tobi at gcc dot gnu.org> --- We are running into this error routinely when using gsl::span for work on memory blocks, and because that code invokes a number of templates along the way, the warnings usually come and go as the code is modified in seemingly unrelated ways. I was thinking that printing a negative number with a correspondingly refined text would be more useful, but then I had the following idea: since a memory area can never be larger than 0x7fffffffffff bytes (or the corresponding on 64 bit), maybe it would make sense to force values to zero if the highest bit is set? To be clear: I'm assuming that the program would be undefined if one actually were to copy such a large number of bytes. OTOH this might kill valid warnings if the user accidentally entered a negative number (more precisely: a wrapped-around number).