Fix some test bugs found by ubsan.
libstdc++-v3/ChangeLog:
* testsuite/20_util/from_chars/3.cc: Use unsigned type to avoid
overflow.
* testsuite/24_iterators/reverse_iterator/2.cc: Do not add
non-zero value to null pointer.
* testsuite/25_algorithms/copy_backward/move_iterators/69478.cc:
Use past-the-end iterator for result.
* testsuite/25_algorithms/move_backward/69478.cc: Likewise.
* testsuite/25_algorithms/move_backward/93872.cc: Likewise.
(cherry picked from commit
6fb8b67089119b737ccb38f75f403b8d279e2229)
read(const char* first, const char* last, int base)
{
long long val = 0;
- long long place = 1;
+ unsigned long long place = 1;
while (last > first)
{
val += (*--last - '0') * place;
iterator_type it01;
iterator_type it02;
- // Sanity check non-member operators and functions can be instantiated.
+ // Sanity check non-member operators and functions can be instantiated.
it01 == it02;
it01 != it02;
it01 < it02;
it01 > it02;
it01 >= it02;
it01 - it02;
- 5 + it02;
+ 0 + it02;
}
-int main()
-{
+int main()
+{
test02();
return 0;
}
static_assert(std::is_trivial<trivial_rvalstruct>::value, "");
trivial_rvalstruct a[1], b[1];
- copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b);
+ copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b+1);
}
// { dg-prune-output "use of deleted" }
static_assert(std::is_trivial<trivial_rvalstruct>::value, "");
trivial_rvalstruct a[1], b[1];
- std::move_backward(a, a + 1, b);
+ std::move_backward(a, a + 1, b + 1);
}
// { dg-prune-output "use of deleted" }
test01()
{
X a[2], b[2];
- std::move_backward(std::begin(a), std::end(a), std::begin(b));
+ std::move_backward(std::begin(a), std::end(a), std::end(b));
}