Page MenuHomePhabricator
Feed Advanced Search

Today

huixie90 committed rG4851fbc3cf23: fix errors on passing input iterator to `std::views::take` (authored by huixie90).
fix errors on passing input iterator to `std::views::take`
Sun, Sep 25, 7:43 AM · Restricted Project, Restricted Project
huixie90 closed D133220: [libc++][ranges] fix errors on passing input iterator to `std::views::take`.
Sun, Sep 25, 7:43 AM · Restricted Project, Restricted Project

Fri, Sep 23

huixie90 accepted D133661: [libc++] Improve binary size when using __transaction.
Fri, Sep 23, 9:13 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D133220: [libc++][ranges] fix errors on passing input iterator to `std::views::take`.
Fri, Sep 23, 4:21 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D133220: [libc++][ranges] fix errors on passing input iterator to `std::views::take`.

addressed comments

Fri, Sep 23, 4:21 AM · Restricted Project, Restricted Project

Fri, Sep 16

huixie90 added a comment to D133560: [libc++] split `<istream>` header.

The approach we generally take is to create a libcxx/include/__fwd/foo.h header. Would that work here?

Fri, Sep 16, 2:48 PM · Restricted Project, Restricted Project

Sun, Sep 11

huixie90 added inline comments to D133661: [libc++] Improve binary size when using __transaction.
Sun, Sep 11, 12:06 PM · Restricted Project, Restricted Project
huixie90 retitled D133560: [libc++] split `<istream>` header from [libcxx] split `<istream>` header to [libc++] split `<istream>` header.
Sun, Sep 11, 8:48 AM · Restricted Project, Restricted Project
huixie90 retitled D133317: [libc++][ranges] implement `std::views::istream` from [libcxx][ranges] implement `std::views::istream` to [libc++][ranges] implement `std::views::istream`.
Sun, Sep 11, 8:48 AM · Restricted Project, Restricted Project
huixie90 retitled D133220: [libc++][ranges] fix errors on passing input iterator to `std::views::take` from fix errors on passing input iterator to `std::views::take` to [libc++][ranges] fix errors on passing input iterator to `std::views::take`.
Sun, Sep 11, 8:48 AM · Restricted Project, Restricted Project
huixie90 retitled D133317: [libc++][ranges] implement `std::views::istream` from implement `std::views::istream` to [libcxx][ranges] implement `std::views::istream`.
Sun, Sep 11, 8:47 AM · Restricted Project, Restricted Project
huixie90 retitled D133560: [libc++] split `<istream>` header from split `<istream>` header to [libcxx] split `<istream>` header.
Sun, Sep 11, 8:47 AM · Restricted Project, Restricted Project
huixie90 published D133560: [libc++] split `<istream>` header for review.
Sun, Sep 11, 4:39 AM · Restricted Project, Restricted Project

Wed, Sep 7

huixie90 updated the summary of D133317: [libc++][ranges] implement `std::views::istream`.
Wed, Sep 7, 10:46 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D133317: [libc++][ranges] implement `std::views::istream`.

added transitive includes to istream

Wed, Sep 7, 10:41 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D133317: [libc++][ranges] implement `std::views::istream`.

fix CI

Wed, Sep 7, 12:17 AM · Restricted Project, Restricted Project

Tue, Sep 6

huixie90 accepted D133323: [libc++] Bump _LIBCPP_STD_VER to the next expected C++ version.

LGTM

Tue, Sep 6, 1:26 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D133317: [libc++][ranges] implement `std::views::istream`.
Tue, Sep 6, 1:16 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D133317: [libc++][ranges] implement `std::views::istream`.

addressed feedback

Tue, Sep 6, 1:16 PM · Restricted Project, Restricted Project
huixie90 accepted D131898: [libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction).
Tue, Sep 6, 5:25 AM · Restricted Project, Restricted Project

Mon, Sep 5

huixie90 updated the diff for D133317: [libc++][ranges] implement `std::views::istream`.

address review feedback

Mon, Sep 5, 11:07 AM · Restricted Project, Restricted Project
huixie90 requested review of D133317: [libc++][ranges] implement `std::views::istream`.
Mon, Sep 5, 8:47 AM · Restricted Project, Restricted Project
huixie90 requested changes to D132796: [libc++][PMR] Implement pmr::memory_resource.
Mon, Sep 5, 2:42 AM · Restricted Project, Restricted Project

Sat, Sep 3

huixie90 added a comment to D131898: [libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction).

Almost LGTM. Just two small clarification questions

Sat, Sep 3, 9:46 PM · Restricted Project, Restricted Project

Fri, Sep 2

huixie90 requested review of D133220: [libc++][ranges] fix errors on passing input iterator to `std::views::take`.
Fri, Sep 2, 11:26 AM · Restricted Project, Restricted Project

Wed, Aug 31

huixie90 added inline comments to D133013: [libc++] Enable rvalue overloads for pair in C++03.
Wed, Aug 31, 10:04 AM · Restricted Project, Restricted Project

Tue, Aug 30

huixie90 accepted D130695: [libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`.

LGMT with nits and with green CI

Tue, Aug 30, 12:56 PM · Restricted Project, Restricted Project

Sun, Aug 28

huixie90 accepted D132340: [libc++] Remove noexcept specifier from operator""s.

LGTM with green CI

Sun, Aug 28, 2:44 AM · Restricted Project, Restricted Project
huixie90 accepted D132327: [libc++] Implement P2445R1 (`std::forward_like`).

LGTM with nits. I will leave the final approval to others who also commented on this patch.

Sun, Aug 28, 2:42 AM · Restricted Project, Restricted Project

Aug 25 2022

huixie90 added inline comments to D132505: [libc++] Refactor deque::iterator algorithm optimizations.
Aug 25 2022, 7:36 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D131495: [libc++] implement "pair" section of P2321R2 `zip`.

attempt to fix CI

Aug 25 2022, 6:18 AM · Restricted Project, Restricted Project
huixie90 requested changes to D132505: [libc++] Refactor deque::iterator algorithm optimizations.
Aug 25 2022, 6:06 AM · Restricted Project, Restricted Project
huixie90 added a comment to D132505: [libc++] Refactor deque::iterator algorithm optimizations.

I found this approach "having a boolean + some operations" less clearer than defining a concept (or pseudo concept with constexpr bool + sfinae) with several customization points.

Aug 25 2022, 6:06 AM · Restricted Project, Restricted Project

Aug 24 2022

huixie90 added inline comments to D131495: [libc++] implement "pair" section of P2321R2 `zip`.
Aug 24 2022, 1:08 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D131495: [libc++] implement "pair" section of P2321R2 `zip`.

address issues

Aug 24 2022, 1:08 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D131495: [libc++] implement "pair" section of P2321R2 `zip`.
Aug 24 2022, 6:46 AM · Restricted Project, Restricted Project

Aug 23 2022

huixie90 added inline comments to D132327: [libc++] Implement P2445R1 (`std::forward_like`).
Aug 23 2022, 11:54 PM · Restricted Project, Restricted Project
huixie90 added a comment to D132509: [libc++] Use _Lazy in tuple constructors.

Thanks for the fix!

Aug 23 2022, 11:35 PM · Restricted Project, Restricted Project

Aug 21 2022

huixie90 added a comment to D132312: [libc++][spaceship] Implement `operator<=>` for `list`.

I think I also agree on the comments with regard to the tests

Aug 21 2022, 1:14 PM · Restricted Project, Restricted Project
huixie90 added a comment to D131836: [libc++][CI] increases constexpr evaluation limit..

I like this change. I have several range algorithm tests which I have to separate some tests into multiple test functions because of the limit. Thanks for doing that.

Aug 21 2022, 1:05 PM · Restricted Project, Restricted Project
huixie90 accepted D131395: [libc++] Implement `lexicographical_compare_three_way`.

LGTM with nits. I will leave the final approval to others who also commented

Aug 21 2022, 1:03 PM · Restricted Project, Restricted Project
huixie90 added a comment to D132151: [libc++] Make <ranges> non-experimental.

Great. thanks!

Aug 21 2022, 12:43 PM · Restricted Project, Restricted Project
huixie90 requested changes to D132327: [libc++] Implement P2445R1 (`std::forward_like`).
Aug 21 2022, 12:37 PM · Restricted Project, Restricted Project

Aug 18 2022

huixie90 requested changes to D131898: [libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction).
Aug 18 2022, 1:01 PM · Restricted Project, Restricted Project
huixie90 accepted D132016: [libc++] Mark everything inside vector as _LIBCPP_HIDE_FROM_ABI.

LGTM

Aug 18 2022, 11:11 AM · Restricted Project, Restricted Project

Aug 17 2022

huixie90 accepted D132032: [libc++][NFC] Add a short description for __split_buffer.

LGMT

Aug 17 2022, 12:49 PM · Restricted Project, Restricted Project
huixie90 accepted D132028: [libc++] Replace _LIBCPP_INLINE_VISIBILITY and mark all functions _LIBCPP_HIDE_FROM_ABI in __split_buffer.

LGTM

Aug 17 2022, 12:47 PM · Restricted Project, Restricted Project

Aug 16 2022

huixie90 added inline comments to D131395: [libc++] Implement `lexicographical_compare_three_way`.
Aug 16 2022, 1:40 PM · Restricted Project, Restricted Project

Aug 15 2022

huixie90 added inline comments to D131395: [libc++] Implement `lexicographical_compare_three_way`.
Aug 15 2022, 1:29 PM · Restricted Project, Restricted Project
huixie90 accepted D121436: [libc++][ranges] Add ranges::out_value_result.

LGTM with green CI and comments addressed

Aug 15 2022, 1:05 PM · Restricted Project, Restricted Project
huixie90 accepted D121436: [libc++][ranges] Add ranges::out_value_result.

LGTM with comments addressed and green CI

Aug 15 2022, 1:05 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D129094: [libc++] Simplify type_traits a bit more.
Aug 15 2022, 12:50 PM · Restricted Project, Restricted Project
huixie90 accepted D131856: [libc++][NFC] Remove some of the code duplication in the string tests.

LGTM

Aug 15 2022, 12:33 PM · Restricted Project, Restricted Project
huixie90 accepted D131868: [libc++][NFC] Refactor enable_ifs in vector.

LGTM with comments addressed. lots of enable_ifs are checking the cpp 17 forward iterator. I wonder if we can relax it to cpp 20 forward iterator. (cpp 17 forward iterator requires reference being a reference type, which is not important for these vector members IIUC)

Aug 15 2022, 12:23 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D131668: [libc++] Implement P2438R2 (std::string::substr() &&).
Aug 15 2022, 11:48 AM · Restricted Project, Restricted Project

Aug 11 2022

huixie90 added inline comments to D131498: [libc++][NFC] Rename the constexpr macros.
Aug 11 2022, 3:38 PM · Restricted Project, Restricted Project
huixie90 requested changes to D131395: [libc++] Implement `lexicographical_compare_three_way`.
Aug 11 2022, 3:31 PM · Restricted Project, Restricted Project
huixie90 added a comment to D131620: [libc++] Use __builtin_unreachable unconditionally.

LGTM. I would leave approvals to others

Aug 11 2022, 2:04 PM · Restricted Project, Restricted Project

Aug 10 2022

huixie90 published D131495: [libc++] implement "pair" section of P2321R2 `zip` for review.
Aug 10 2022, 9:47 AM · Restricted Project, Restricted Project

Aug 8 2022

Herald added a project to D118329: [libc++] Optimize algorithms on uninitialized memory for trivial types.: Restricted Project.
Aug 8 2022, 11:00 AM · Restricted Project, Restricted Project
huixie90 accepted D131322: [libc++] Fixes string_view comparison operators..

LGTM

Aug 8 2022, 9:44 AM · Restricted Project, Restricted Project

Aug 4 2022

huixie90 accepted D130835: [libc++] Fix a hard error in `contiguous_iterator<NoOperatorArrowIter>`..

LGTM after Louis's comments are addressed

Aug 4 2022, 12:15 AM · Restricted Project, Restricted Project

Jul 29 2022

huixie90 committed rG72f57e3a30d5: [libc++][ranges] implement `std::ranges::unique{_copy}` (authored by huixie90).
[libc++][ranges] implement `std::ranges::unique{_copy}`
Jul 29 2022, 12:29 AM · Restricted Project, Restricted Project
huixie90 closed D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.
Jul 29 2022, 12:28 AM · Restricted Project, Restricted Project

Jul 28 2022

huixie90 updated subscribers of D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.

Also thanks to @Quuxplusone who contacted me and spotted that I missed an if constexpr in ranges::unique_copy and an unnecessary next call in adjacent_find

Jul 28 2022, 1:14 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.

address review feedback

Jul 28 2022, 1:05 PM · Restricted Project, Restricted Project
huixie90 published D130599: [libc++][ranges] Implement `ranges::remove_copy{, _if}`. for review.
Jul 28 2022, 8:56 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.

got patch number wrong

Jul 28 2022, 8:52 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.
  • finalise ranges::remove_copy{_if}
Jul 28 2022, 8:50 AM · Restricted Project, Restricted Project
huixie90 added inline comments to D130532: [libc++][ranges] Implement `std::ranges::partial_sort_copy`..
Jul 28 2022, 4:04 AM · Restricted Project, Restricted Project
huixie90 committed rG8a61749f767e: [libc++][ranges] implement `std::ranges::inplace_merge` (authored by huixie90).
[libc++][ranges] implement `std::ranges::inplace_merge`
Jul 28 2022, 12:40 AM · Restricted Project, Restricted Project
huixie90 closed D130627: [libc++][ranges] implement `std::ranges::inplace_merge`.
Jul 28 2022, 12:39 AM · Restricted Project, Restricted Project, Restricted Project

Jul 27 2022

huixie90 updated the diff for D130627: [libc++][ranges] implement `std::ranges::inplace_merge`.

address comments

Jul 27 2022, 3:35 PM · Restricted Project, Restricted Project, Restricted Project
huixie90 updated the diff for D130627: [libc++][ranges] implement `std::ranges::inplace_merge`.

add newline

Jul 27 2022, 2:58 PM · Restricted Project, Restricted Project, Restricted Project
huixie90 updated the diff for D130627: [libc++][ranges] implement `std::ranges::inplace_merge`.

address review feedback

Jul 27 2022, 2:53 PM · Restricted Project, Restricted Project, Restricted Project
huixie90 accepted D130538: [libc++] Make `_IterOps::__iter_move` more similar to `std::ranges::iter_move`..
Jul 27 2022, 12:25 PM · Restricted Project, Restricted Project
huixie90 updated the diff for D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.

rebase

Jul 27 2022, 11:51 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D130627: [libc++][ranges] implement `std::ranges::inplace_merge`.

fix CI

Jul 27 2022, 11:42 AM · Restricted Project, Restricted Project, Restricted Project
huixie90 published D130627: [libc++][ranges] implement `std::ranges::inplace_merge` for review.
Jul 27 2022, 8:26 AM · Restricted Project, Restricted Project, Restricted Project
huixie90 added inline comments to D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.
Jul 27 2022, 5:52 AM · Restricted Project, Restricted Project
huixie90 updated the diff for D130404: [libc++][ranges] implement `std::ranges::unique{_copy}`.

addresss feedback

Jul 27 2022, 5:52 AM · Restricted Project, Restricted Project

Jul 26 2022

huixie90 added a comment to D130515: [libc++][ranges] Make sure all range algorithms support differing projection types:.

The fix looks good to me and I think we should delete the overload __make_projected_comp(__comp, __proj1, __proj2) and replace all the usages with hand coded std::invoke

Without this test, I'd agree. With the test, however, I think the benefits outweigh the drawbacks. If an algorithm switches the comparison order, this test will break. However, make_projected_comp not only reduces on boilerplate and keeps most internal algorithms unaware of projections, it also allows passing in the original comparator without modification and "eliding" identity when possible.

Jul 26 2022, 4:02 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms..
Jul 26 2022, 3:41 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130547: [libc++][ranges] Implement `ranges::is_heap{,_until}`..
Jul 26 2022, 3:33 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130552: [libc++][ranges] Implement `ranges::generate{,_n}`..
Jul 26 2022, 3:22 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130595: [libc++][doc] Updates status documents..
Jul 26 2022, 3:10 PM · Restricted Project, Restricted Project
huixie90 accepted D130595: [libc++][doc] Updates status documents..
Jul 26 2022, 1:28 PM · Restricted Project, Restricted Project
huixie90 added inline comments to D130532: [libc++][ranges] Implement `std::ranges::partial_sort_copy`..
Jul 26 2022, 1:25 PM · Restricted Project, Restricted Project
huixie90 accepted D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms..
Jul 26 2022, 1:15 PM · Restricted Project, Restricted Project
huixie90 accepted D130547: [libc++][ranges] Implement `ranges::is_heap{,_until}`..

Almost LGTM thanks!

Jul 26 2022, 7:34 AM · Restricted Project, Restricted Project
huixie90 accepted D130552: [libc++][ranges] Implement `ranges::generate{,_n}`..
Jul 26 2022, 6:09 AM · Restricted Project, Restricted Project
huixie90 accepted D130532: [libc++][ranges] Implement `std::ranges::partial_sort_copy`..
Jul 26 2022, 5:59 AM · Restricted Project, Restricted Project
huixie90 added a comment to D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms..

LGMT

Jul 26 2022, 4:17 AM · Restricted Project, Restricted Project
huixie90 accepted D130515: [libc++][ranges] Make sure all range algorithms support differing projection types:.

This is a definitely needed fix. Whether or not to fix set_* algorithms in the same patch should not block this patch.

Jul 26 2022, 3:53 AM · Restricted Project, Restricted Project
huixie90 added a comment to D129823: [libc++][ranges] Make range algorithms support proxy iterators.

@alexfh @jgorbe @rupprecht Thank you for the additional details! I believe the analysis by @huixie90 is spot on and have prepared a patch based on it: https://reviews.llvm.org/D130538
Can you try out the patch to see if it resolves the issue you're seeing? It does fix the repro case for me.

Thanks! Unfortunately, it just changes the failure that we now see from a crash to a weird runtime failure; incorrectly sorted results, I assume.

I have an alternative change to fix the UB and return varlen_element & instead of varlen_element (isn't that the eventual fix we should do anyway?), and initial tests seem to be passing now. I'm not sure what D130538 is missing.

Jul 26 2022, 3:51 AM · Restricted Project, Restricted Project

Jul 25 2022

huixie90 added a comment to D129823: [libc++][ranges] Make range algorithms support proxy iterators.

Some more information about the problem. The stack trace looks like follows. The problem manifests as an ASan out of memory error because the move constructor in varlen_sort.h:59 is getting incorrect data and it's trying to allocate an absurdly big amount of memory.

==7713==ERROR: AddressSanitizer: out of memory: allocator is trying to allocate 0xc5600000e4e bytes
    #0 0x55deed3caedd in operator new[](unsigned long) third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:98:3
    #1 0x55deed6e733c in varlen_element MYSQLSRCHOME/include/varlen_sort.h:59:17
    #2 0x55deed6e733c in bool std::__u::__insertion_sort_incomplete<void varlen_sort<unsigned char, DsMrr_impl::dsmrr_fill_buffer()::$_3>(unsigned char*, unsigned char*, unsigned long, DsMrr_impl::dsmrr_fill_buffer()::$_3)::'lambda'(varlen_element const&, varlen_element const&)&, varlen_iterator>(DsMrr_impl::dsmrr_fill_buffer()::$_3, DsMrr_impl::dsmrr_fill_buffer()::$_3, unsigned char) third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/sort.h:373:18
    #3 0x55deed6e4fcd in void std::__u::__introsort<std::__u::_ClassicAlgPolicy, void varlen_sort<unsigned char, DsMrr_impl::dsmrr_fill_buffer()::$_3>(unsigned char*, unsigned char*, unsigned long, DsMrr_impl::dsmrr_fill_buffer()::$_3)::'lambda'(varlen_element const&, varlen_element const&)&, varlen_iterator>(varlen_iterator, varlen_iterator, DsMrr_impl::dsmrr_fill_buffer()::$_3, std::__u::iterator_traits<varlen_iterator>::difference_type) third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/sort.h:575:19
    #4 0x55deed6db70b in __sort<(lambda at MYSQLSRCHOME/include/varlen_sort.h:199:13) &, varlen_iterator> third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/sort.h:627:3
    #5 0x55deed6db70b in __sort_impl<std::__u::_ClassicAlgPolicy, varlen_iterator, (lambda at MYSQLSRCHOME/include/varlen_sort.h:199:13)> third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/sort.h:687:5
    #6 0x55deed6db70b in sort<varlen_iterator, (lambda at MYSQLSRCHOME/include/varlen_sort.h:199:13)> third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__algorithm/sort.h:694:3
    #7 0x55deed6db70b in varlen_sort<unsigned char, (lambda at MYSQLSRCHOME/sql/handler.cc:6738:7)> MYSQLSRCHOME/include/varlen_sort.h:197:3
    #8 0x55deed6db70b in DsMrr_impl::dsmrr_fill_buffer() MYSQLSRCHOME/sql/handler.cc:6736:3
    #9 0x55deed6da9c8 in DsMrr_impl::dsmrr_init(RANGE_SEQ_IF*, void*, unsigned int, unsigned int, HANDLER_BUFFER*) MYSQLSRCHOME/sql/handler.cc:6617:17
    #10 0x55deedf21bb6 in MultiRangeRowIterator::Init() MYSQLSRCHOME/sql/bka_iterator.cc:368:18
    #11 0x55deedf21100 in BKAIterator::ReadOuterRows() MYSQLSRCHOME/sql/bka_iterator.cc:228:22
    #12 0x55deedf2174a in BKAIterator::Read() MYSQLSRCHOME/sql/bka_iterator.cc:274:19
    #13 0x55deede3ed6b in Query_expression::ExecuteIteratorQuery(THD*) MYSQLSRCHOME/sql/sql_union.cc:1231:36
    #14 0x55deede3f4e4 in Query_expression::execute(THD*) MYSQLSRCHOME/sql/sql_union.cc:1284:10
    #15 0x55deedd5a4f6 in Sql_cmd_dml::execute_inner(THD*) MYSQLSRCHOME/sql/sql_select.cc:776:15
    #16 0x55deedd59381 in Sql_cmd_dml::execute(THD*) MYSQLSRCHOME/sql/sql_select.cc:574:7
    #17 0x55deedcb2863 in mysql_execute_command(THD*, bool) MYSQLSRCHOME/sql/sql_parse.cc:4438:29
    #18 0x55deedcae283 in dispatch_sql_command(THD*, Parser_state*) MYSQLSRCHOME/sql/sql_parse.cc:5037:19
    #19 0x55deedcaac9c in dispatch_command(THD*, COM_DATA const*, enum_server_command) MYSQLSRCHOME/sql/sql_parse.cc:1863:7
    #20 0x55deedcacd8b in do_command(THD*) MYSQLSRCHOME/sql/sql_parse.cc:1342:18
    #21 0x55deed3fe4f3 in handle_connection(void*) MYSQLSRCHOME/sql/conn_handler/connection_handler_per_thread.cc:310:13
    #22 0x55def2434649 in pfs_spawn_thread(void*) MYSQLSRCHOME/storage/perfschema/pfs.cc:2905:3
    #23 0x7f6af0285b54 in start_thread (/usr/grte/v5/lib64/libpthread.so.0+0xbb54) (BuildId: 64752de50ebd1a108f4b3f8d0d7e1a13)

sort.h:373 does

	      value_type __t(_Ops::__iter_move(__i));

When reaching this line the value of __i is correct. However, after the call to __iter_move, the varlen_element move constructor (source) gets incorrect values.

I've managed to get the test to pass by replacing occurrences of _Ops::__iter_move(iter) back to _VSTD::move(*iter) and I don't see anything particularly wrong with the affected mysql code so I suspect there's some remaining problem in __iter_move that hasn't been solved with the follow-up patches so far.

Jul 25 2022, 6:10 PM · Restricted Project, Restricted Project
huixie90 added a comment to D130515: [libc++][ranges] Make sure all range algorithms support differing projection types:.

The fix looks good to me and I think we should delete the overload __make_projected_comp(__comp, __proj1, __proj2) and replace all the usages with hand coded std::invoke

Jul 25 2022, 5:32 PM · Restricted Project, Restricted Project
huixie90 published D130404: [libc++][ranges] implement `std::ranges::unique{_copy}` for review.
Jul 25 2022, 9:40 AM · Restricted Project, Restricted Project

Jul 23 2022

huixie90 added a comment to D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms..

My original test has some coverage (would fail on gcc). I am trying to figure out why clang passes the test. See this reproduction example (it is basically my original test plus making Reference destructor to set _i to be nullptr

That's exactly my experience with compiler warnings and tools like Asan -- all of them are essentially "best effort" and aren't reliable ("reliable" in the sense "guaranteed to catch 100% of issues"). In fact, when I did the first patch to fix the Chromium issue, Clang could see the dangling temporary in the original version of __iter_move (that returned a dangling value_type) but not in the version from the patch (that returned a dangling reference), even though both were equally UB and essentially the same issue. You encountered a very similar problem where GCC sees a lifetime issue while Clang doesn't. I'm sure there exist counterexamples where Clang would catch something that GCC cannot spot. The point is, these warnings aren't meant to validate that the code is correct -- while their presence almost always indicates a problem, their absence doesn't guarantee there is no problem. Asan similarly cannot catch all issues. To be clear, all these tools are very helpful, but should be used for their intended purpose and not to verify that code is correct.

However, the assertion assert(i==5) isn't triggered because of the Undefined Behaviour. The compiler doesn't even bother assert as i is just rubbish value.

The assertion isn't triggered because the program segfaults on the line that calls iter_move. Unfortunately, Godbolt output doesn't make it very clear, but 139 isn't the value of i, it's the return code of a program upon receiving sigsegv (11, which is the code of the signal, + 128).

From the perspective of the standard, the Godbolt program might be equivalently undefined compared to this patch, but in practice there is a very important difference -- the program dereferences this after the destructor has been run, while this patch doesn't.

To be clear, I would love to do it another way that doesn't require this sort of "this is technically undefined but works in practice" analysis. Unfortunately, I don't really see it. constexpr would be the perfect solution if it were not for the coverage problems. I think that tooling works best as complimentary, not the exclusive means of detecting this sort of issue.

There are some possible mitigations we could do as well. We can make sure this test runs without optimizations, we may restrict it to a certain compiler version if need be, and we could add a fail.cpp test to make sure it actually fails in practice (when encountering memory problems). I think this is overkill, personally, but wouldn't object if you feel strongly about this.

Jul 23 2022, 12:00 PM · Restricted Project, Restricted Project
huixie90 added a comment to D128146: [libc++] Use uninitialized algorithms for vector.

@philnik , can you please help me understand what is going on with the original example posted by @bgraur ?

The fact is that the example compiled before this patch and failed with this patch. Even if the example is buggy, I still need to understand what the semantics were when it worked. Was it using the wrong ctor? Why did it change with this patch?

I'm seeing a number of tests failing with this patch, so understanding the example might give me a clue where to look.

Jul 23 2022, 12:11 AM · Restricted Project, Restricted Project