Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc-10: failures in copy-constructors due to [[no_unique_address]]. #307

Closed
williamspatrick opened this issue Jun 27, 2021 · 3 comments
Closed

Comments

@williamspatrick
Copy link
Contributor

I am seeing lots of failures in gcc-10 reporting issues with copy-constructors "... is implicitly deleted because the default definition would be ill-formed". This seems to be caused by the use of UNIFEX_NO_UNIQUE_ADDRESS but I'm stumped as to why. (i.e. changing UNIFEX_NO_UNIQUE_ADDRESS to empty allows everything to compile.)

$ cmake -G Ninja -H. -Bbuild -DCMAKE_CXX_FLAGS:STRING=-fcoroutines -DCMAKE_CXX_STANDARD:STRING=20 -DUNIFEX_BUILD_EXAMPLES=yes -DBUILD_TESTING=yes

Using commit 797690d.

$ gcc --version    
gcc (Gentoo 10.3.0-r1 p2) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
FAILED: examples/CMakeFiles/never_stream_cancellation.dir/never_stream_cancellation.cpp.o 
/usr/bin/c++  -I../source/../include -Iinclude -fcoroutines -std=gnu++2a -MD -MT examples/CMakeFiles/never_stream_cancellation.dir/never_stream_cancellation.cpp.o -MF examples/CMakeFiles/never_stream_cancellation.dir/never_stream_cancellation.cpp.o.d -o examples/CMakeFiles/never_stream_cancellation.dir/never_stream_cancellation.cpp.o -c ../examples/never_stream_cancellation.cpp
In file included from ../examples/never_stream_cancellation.cpp:21:
../source/../include/unifex/stop_when.hpp: In instantiation of ‘unifex::_stop_when::_op<Source, Trigger, Receiver>::type::type(Source&&, Trigger&&, Receiver2&&) [with Receiver2 = unifex::_sync_wait::_receiver<unifex::_unit::unit>::type; Source = unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&; Trigger = unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&; Receiver = unifex::_sync_wait::_receiver<unifex::_unit::unit>::type]’:
../source/../include/unifex/stop_when.hpp:344:32:   required from ‘unifex::_stop_when::stop_when_operation<decltype (static_cast<Sender&& (*)()noexcept (true)>(nullptr)().*(_memptr<Predecessor>)(static_cast<Sender&& (*)()noexcept (true)>(nullptr)())), decltype (static_cast<Sender&& (*)()noexcept (true)>(nullptr)().*(_memptr<Func>)(static_cast<Sender&& (*)()noexcept (true)>(nullptr)())), typename unifex::remove_cvref<Self>::type> unifex::_stop_when::tag_invoke(unifex::tag_t<unifex::_connect_cpo::connect>, Self&&, Receiver&&) [with Self = unifex::_stop_when::_sndr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type>::type; Receiver = unifex::_sync_wait::_receiver<unifex::_unit::unit>::type; Source = unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type; Trigger = unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type; unifex::_stop_when::stop_when_operation<decltype (static_cast<Sender&& (*)()noexcept (true)>(nullptr)().*(_memptr<Predecessor>)(static_cast<Sender&& (*)()noexcept (true)>(nullptr)())), decltype (static_cast<Sender&& (*)()noexcept (true)>(nullptr)().*(_memptr<Func>)(static_cast<Sender&& (*)()noexcept (true)>(nullptr)())), typename unifex::remove_cvref<Self>::type> = unifex::_stop_when::_op<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type; typename unifex::remove_cvref<Self>::type = unifex::_sync_wait::_receiver<unifex::_unit::unit>::type; decltype (static_cast<Sender&& (*)()noexcept (true)>(nullptr)().*(_memptr<Func>)(static_cast<Sender&& (*)()noexcept (true)>(nullptr)())) = unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&; decltype (static_cast<Sender&& (*)()noexcept (true)>(nullptr)().*(_memptr<Predecessor>)(static_cast<Sender&& (*)()noexcept (true)>(nullptr)())) = unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&; unifex::tag_t<unifex::_connect_cpo::connect> = unifex::_connect_cpo::_fn]’
../source/../include/unifex/tag_invoke.hpp:33:26:   required from ‘constexpr decltype (unifex::_tag_invoke::tag_invoke((CPO&&)(cpo), (Args&&(unifex::_tag_invoke::_fn::operator()::args))...)) unifex::_tag_invoke::_fn::operator()(CPO, Args&& ...) const [with CPO = unifex::_connect_cpo::_fn; Args = {unifex::_stop_when::_sndr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type>::type, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type}; decltype (unifex::_tag_invoke::tag_invoke((CPO&&)(cpo), (Args&&(unifex::_tag_invoke::_fn::operator()::args))...)) = unifex::_stop_when::_op<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type]’
../source/../include/unifex/sender_concepts.hpp:285:32:   required from ‘unifex::_connect_cpo::_fn::_result_t<Sender, Receiver> unifex::_connect_cpo::_fn::operator()(Sender&&, Receiver&&) const [with Sender = unifex::_stop_when::_sndr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type>::type; Receiver = unifex::_sync_wait::_receiver<unifex::_unit::unit>::type; unifex::_connect_cpo::_fn::_result_t<Sender, Receiver> = unifex::_stop_when::_op<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type]’
../source/../include/unifex/sync_wait.hpp:122:27:   required from ‘std::optional<_Tp> unifex::_sync_wait::_impl(Sender&&) [with Result = unifex::_unit::unit; Sender = unifex::_stop_when::_sndr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type>::type]’
../source/../include/unifex/sync_wait.hpp:150:39:   required from ‘std::optional<typename unifex::_if<is_void_v<typename unifex::_if<is_reference_v<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > >::apply<std::reference_wrapper<typename std::remove_reference<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> >::type>, typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > > >::apply<unifex::_unit::unit, typename unifex::_if<is_reference_v<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > >::apply<std::reference_wrapper<typename std::remove_reference<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> >::type>, typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > > > unifex::_sync_wait_cpo::_fn::operator()(Sender&&) const [with Sender = unifex::_stop_when::_sndr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type>::type; typename unifex::_if<is_void_v<typename unifex::_if<is_reference_v<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > >::apply<std::reference_wrapper<typename std::remove_reference<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> >::type>, typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > > >::apply<unifex::_unit::unit, typename unifex::_if<is_reference_v<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > >::apply<std::reference_wrapper<typename std::remove_reference<typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> >::type>, typename unifex::_if<is_lvalue_reference_v<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type> >::apply<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type, typename unifex::remove_cvref<typename unifex::sender_traits<typename unifex::remove_cvref<T>::type>::value_types<unifex::single_overload, unifex::single_value_type>::type::type>::type> > > = unifex::_unit::unit]’
../examples/never_stream_cancellation.cpp:47:77:   required from here
../source/../include/unifex/stop_when.hpp:184:76: error: use of deleted function ‘unifex::_reduce::_op<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> >, unifex::_tfx::_receiver<unifex::_stop_when::_srcvr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type, unifex::_for_each::_impl::_reduce>::type>::type::type(const unifex::_reduce::_op<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> >, unifex::_tfx::_receiver<unifex::_stop_when::_srcvr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type, unifex::_for_each::_impl::_reduce>::type>::type&)’
  184 |               unifex::connect((Trigger &&) trigger, trigger_receiver{this})) {}
      |                                                                            ^
In file included from ../source/../include/unifex/for_each.hpp:18,
                 from ../examples/never_stream_cancellation.cpp:17:
../source/../include/unifex/reduce_stream.hpp:239:57: note: ‘unifex::_reduce::_op<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> >, unifex::_tfx::_receiver<unifex::_stop_when::_srcvr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type, unifex::_for_each::_impl::_reduce>::type>::type::type(const unifex::_reduce::_op<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> >, unifex::_tfx::_receiver<unifex::_stop_when::_srcvr<unifex::_tfx::_sender<unifex::_reduce::_sender<unifex::_never::stream, unifex::_unit::unit, unifex::_for_each::_impl::_map<main()::<lambda(auto:45)> > >::type, unifex::_for_each::_impl::_reduce>::type&&, unifex::_tfx::_sender<unifex::_timed_single_thread_context::_schedule_after_sender<std::chrono::duration<long int, std::ratio<1, 1000> > >::type, main()::<lambda()> >::type&&, unifex::_sync_wait::_receiver<unifex::_unit::unit>::type>::type, unifex::_for_each::_impl::_reduce>::type>::type&)’ is implicitly deleted because the default definition would be ill-formed:
  239 | struct _op<StreamSender, State, ReducerFunc, Receiver>::type {
      |                                        
@ericniebler
Copy link
Collaborator

And this only happens with gcc-10 when coroutines are enabled? How odd.

@williamspatrick
Copy link
Contributor Author

This is not caused by coroutines specifically and fails with coroutines disabled as well.

It turns out this is a regression introduced between 10.2 (which is what Github Actions have for gcc-10) and 10.3 and is also present in the 11 series.

The commit which introduced the regression into 10.3 is:

The Github Action image has gcc-10 as 10.2 which does not have this regression but some of the coroutine unit tests have SEGVs. I ran with a patch to include/unifex/config.hpp to disable the [[no_unique_address]] and that both compiled and passed unit tests on gcc 10.3.

I plan to submit 1 PR to fix up the config.hpp for GCC 10 to disable [[no_unique_address]] until bug 98995 is fixed.
I plan to submit another PR, if I can figure it out, to the Github Action YAML to update to (at least) gcc 10.3.

@williamspatrick
Copy link
Contributor Author

It looks like Github is updating the ubuntu image to 10.3 shortly.

actions/runner-images#3665

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants