This adds a nullptr check to fix a regression where it is possible to call
`memcmp (NULL, NULL, 0)` which is UB prior to C26.
This fixes the bootstrap-ubsan build.
gcc/ChangeLog:
PR middle-end/121261
* vec.h: Add null ptr check.
return false;
if (lhs.size () != rhs.size ())
return false;
+ /* Case where either is a NULL pointer and therefore, as both are valid,
+ both are empty slices with length 0. */
+ if (lhs.size () == 0)
+ return true;
return memcmp (lhs.begin (), rhs.begin (), lhs.size ()) == 0;
}