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

            Bug ID: 109565
           Summary: -Wstrict-overflow false positive
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenb...@fh-soft.de
  Target Milestone: ---

% cat test.cpp
#include <span>

bool f (std::span <int> c)
{
  return size (c) == 2 && begin (c) < end (c);
}
% g++ -c -std=c++20 -O2 -Wstrict-overflow test.cpp
test.cpp: In function ‘bool f(std::span<int>)’:
test.cpp:5:24: warning: assuming pointer wraparound does not occur when
comparing P +- C1 with P +- C2 [-Wstrict-overflow]
    5 |   return size (c) == 2 && begin (c) < end (c);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Reply via email to