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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-07-28
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The ubsan error is coming from:
    return memcmp (lhs.begin (), rhs.begin (), lhs.size ()) == 0;

lhs.size () == 0 but lhs.begin () and rhs.begin () are both nullptr.

So the undefinedness here is not very useful and for that reason in C26, it
became defined when the size is 0. BUT glibc headers still mark the decl as
being undefined for all values of size.

Changing operator== to workaround this is easy.

if (lhs.size() == 0)
  return true;

Right before the memcmp call.

Reply via email to