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

            Bug ID: 93972
           Summary: ranges::lexicographical_compare gives wrong answer for
                    signed integers
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: ppalka at gcc dot gnu.org
  Target Milestone: ---

// -std=gnu++2a
#include <algorithm>
#include <assert.h>

int main()
{
  int i[] = { -1 };
  int j[] = { 1 };
  assert( std::ranges::lexicographical_compare(i, j) );
}


a.out: range.cc:8: int main(): Assertion
`std::ranges::lexicographical_compare(i, j)' failed.
Aborted (core dumped)


It's not valid to use memcmp for signed integers.

Reply via email to