This is the implementation of the first proposal of strict weak ordering checks described in https://discourse.llvm.org/t/rfc-strict-weak-ordering-checks-in-the-debug-libc/70217
This targets the most vulnerable algorithms like std::sort
Paths
| Differential D150264
[libcxx] Add strict weak ordering checks to sorting algorithms ClosedPublic Authored by danlark on May 10 2023, 5:59 AM.
Details
Summary This is the implementation of the first proposal of strict weak ordering checks described in https://discourse.llvm.org/t/rfc-strict-weak-ordering-checks-in-the-debug-libc/70217 This targets the most vulnerable algorithms like std::sort
Diff Detail Event Timeline
danlark marked 8 inline comments as done. Comment ActionsAddress comments
This revision is now accepted and ready to land.May 26 2023, 3:42 PM Comment Actions I don't have commit rights, can you help me submit the change? Danila Kutenin Comment Actions
I tried to land this patch on your behalf, but there are some merge conflicts. Can you rebase the patch on main?
Comment Actions
All done, thanks! Comment Actions
Thanks! I'll wait for the current CI run to finish and land the patch when it's green. This revision was landed with ongoing or failed builds.Jun 4 2023, 10:27 AM Closed by commit rG7e1ee1e10dc0: [libcxx] Add strict weak ordering checks to sorting algorithms (authored by danlark, committed by Mordante). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 522092 libcxx/include/CMakeLists.txt
libcxx/include/__algorithm/sort.h
libcxx/include/__algorithm/sort_heap.h
libcxx/include/__algorithm/stable_sort.h
libcxx/include/__debug
libcxx/include/__debug_utils/strict_weak_ordering_check.h
libcxx/include/module.modulemap.in
libcxx/test/libcxx/algorithms/alg.sorting/assert.sort.invalid_comparator.pass.cpp
libcxx/test/libcxx/private_headers.verify.cpp
libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp
libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/ranges_sort_heap.pass.cpp
libcxx/test/std/algorithms/ranges_robust_against_dangling.pass.cpp
libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp
libcxx/utils/data/ignore_format.txt
llvm/utils/gn/secondary/libcxx/include/BUILD.gn
|
Sorry for being so late to the party, but I think there's a problem here. We should decide whether we want to use these added facilities or __comp_ref_type to catch these kinds of issues. Right now, we have a weird situation where both can potentially be used at the same time. This means that we have the following mechanisms in place and enabled independently:
Is there a reason why we'd want to have these three severely overlapping mechanisms (and especially within the same algorithm)?