https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109565

--- Comment #2 from Frank Heckenbach <f.heckenb...@fh-soft.de> ---
Maybe technically correct, but not useful to the user.

The user's code doesn't involve pointers at all. It makes two queries about a
span object. As the user, I don't even (and shouldn't have to) care whether
pointer wraparound can occur in valid code on the given platform. (I don't
think so on Linux, but I'm not even sure.)

So if it can't validly occur, GCC can assume it doesn't, but won't need to
warn. And if it can occur, it shouldn't do this optimization.

Note that https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html doesn't even
mention pointers (let alone objects such as span) for -Wstrict-overflow.

Reply via email to