[libcxx-commits] [PATCH] D151836: Test for D132092
Vitaly Buka via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 31 13:30:47 PDT 2023
vitalybuka created this revision.
Herald added a project: All.
vitalybuka requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151836
Files:
libcxx/include/deque
libcxx/test/libcxx/containers/sequences/deque/annotate.begin.end.pass.cpp
Index: libcxx/test/libcxx/containers/sequences/deque/annotate.begin.end.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/libcxx/containers/sequences/deque/annotate.begin.end.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <deque>
+
+// Regression test to error in deque::__annotate_from_to in deque.
+
+// REQUIRES: has-unix-headers
+// UNSUPPORTED: c++03
+// XFAIL: availability-verbose_abort-missing
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1
+
+#include <deque>
+
+#include "check_assertion.h"
+
+int main(int, char**) {
+ std::deque<char> test;
+ char buff[100000];
+ test.insert(test.end(), buff, buff + 64000);
+
+ for (int i = 0; i < 1100; i += 1) {
+ test.insert(test.end(), buff, buff + 320);
+ test.erase(test.begin(), test.begin() + 320);
+ }
+
+ test.insert(test.end(), buff, buff + 32000);
+
+ return 0;
+}
Index: libcxx/include/deque
===================================================================
--- libcxx/include/deque
+++ libcxx/include/deque
@@ -1079,6 +1079,14 @@
const void* __new_beg = __front ? __new_edge : __old_edge;
const void* __new_end = __front ? __old_edge : __new_edge;
+ _LIBCPP_ASSERT(__old_beg <= __old_end, "invalide old range");
+ _LIBCPP_ASSERT(__mem_beg <= __old_beg, "invalide old range");
+ _LIBCPP_ASSERT(__old_end <= __mem_end, "invalide old range");
+
+ _LIBCPP_ASSERT(__new_beg <= __new_end, "invalide new range"); // This one fails
+ _LIBCPP_ASSERT(__mem_beg <= __new_beg, "invalide new range");
+ _LIBCPP_ASSERT(__new_end <= __mem_end, "invalide new range");
+
__annotate_double_ended_contiguous_container(__mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151836.527185.patch
Type: text/x-patch
Size: 2198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230531/1cb3d5a6/attachment.bin>
More information about the libcxx-commits
mailing list