From ffcb1020d65d8cd7f229501af2abf95673e9e600 Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Sun, 16 Aug 2026 15:16:02 +0200 Subject: [PATCH 1/2] Fix bulk_chunked zero shape --- include/stdexec/__detail/__bulk.hpp | 6 +++++- test/stdexec/algos/adaptors/test_bulk.cpp | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/include/stdexec/__detail/__bulk.hpp b/include/stdexec/__detail/__bulk.hpp index 73a2a7f4d..158470e1d 100644 --- a/include/stdexec/__detail/__bulk.hpp +++ b/include/stdexec/__detail/__bulk.hpp @@ -281,7 +281,11 @@ namespace STDEXEC STDEXEC_TRY { - __state.__data_.__fun_(__shape_t(), __shape_t(__state.__data_.__shape_), __args...); + if (__shape_t{} < __state.__data_.__shape_) + { + __state.__data_.__fun_( + __shape_t(), __shape_t(__state.__data_.__shape_), __args...); + } STDEXEC::set_value(static_cast<_State&&>(__state).__rcvr_, static_cast<_Args&&>(__args)...); } diff --git a/test/stdexec/algos/adaptors/test_bulk.cpp b/test/stdexec/algos/adaptors/test_bulk.cpp index 4ef06f697..c365e31ad 100644 --- a/test/stdexec/algos/adaptors/test_bulk.cpp +++ b/test/stdexec/algos/adaptors/test_bulk.cpp @@ -701,6 +701,26 @@ namespace ex::start(op); } + TEST_CASE("bulk_chunked function is not called with a zero shape", "[adaptors][bulk]") + { + int called{}; + + auto snd = ex::just() | ex::bulk_chunked(ex::seq, 0, [&called](int, int) { called++; }); + ex::sync_wait(std::move(snd)); + + CHECK(called == 0); + } + + TEST_CASE("bulk_chunked function is not called with a negative shape", "[adaptors][bulk]") + { + int called{}; + + auto snd = ex::just() | ex::bulk_chunked(ex::seq, -1, [&called](int, int) { called++; }); + ex::sync_wait(std::move(snd)); + + CHECK(called == 0); + } + TEST_CASE("bulk_unchunked function in not called on stop", "[adaptors][bulk]") { constexpr int n = 2; From ef2bf691fd68d89c62dee55105fccf982f9625fa Mon Sep 17 00:00:00 2001 From: Minh Vu Date: Sun, 16 Aug 2026 21:00:09 +0200 Subject: [PATCH 2/2] Format bulk chunked changes --- include/stdexec/__detail/__bulk.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/stdexec/__detail/__bulk.hpp b/include/stdexec/__detail/__bulk.hpp index 158470e1d..337af080e 100644 --- a/include/stdexec/__detail/__bulk.hpp +++ b/include/stdexec/__detail/__bulk.hpp @@ -283,8 +283,7 @@ namespace STDEXEC { if (__shape_t{} < __state.__data_.__shape_) { - __state.__data_.__fun_( - __shape_t(), __shape_t(__state.__data_.__shape_), __args...); + __state.__data_.__fun_(__shape_t(), __shape_t(__state.__data_.__shape_), __args...); } STDEXEC::set_value(static_cast<_State&&>(__state).__rcvr_, static_cast<_Args&&>(__args)...);