Open m-chichikalov opened 5 years ago
I can reproduce with gcc version 7.4.0 (Debian 7.4.0-1). Running with -M
gives me the following output. Something pulls in
main.o: test/main.cpp /usr/include/stdc-predef.h test/stdafx.h \
test/../relacy/pch.hpp /usr/include/c++/7/stdlib.h \
/usr/include/c++/7/cstdlib \
/usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h \
/usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/bits/long-double.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/cpu_defines.h \
/usr/include/stdlib.h \
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h \
/usr/include/x86_64-linux-gnu/bits/floatn.h \
/usr/include/x86_64-linux-gnu/bits/floatn-common.h \
/usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
/usr/include/x86_64-linux-gnu/sys/types.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
/usr/include/x86_64-linux-gnu/bits/types/time_t.h \
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
/usr/include/alloca.h /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
/usr/include/c++/7/bits/std_abs.h /usr/include/stdio.h \
/usr/lib/gcc/x86_64-linux-gnu/7/include/stdarg.h \
/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
/usr/include/x86_64-linux-gnu/bits/sys_errlist.h \
/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/limits.h \
/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed/syslimits.h \
/usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \
/usr/include/x86_64-linux-gnu/bits/local_lim.h \
/usr/include/linux/limits.h \
/usr/include/x86_64-linux-gnu/bits/posix2_lim.h \
/usr/include/x86_64-linux-gnu/bits/xopen_lim.h \
/usr/include/x86_64-linux-gnu/bits/uio_lim.h /usr/include/memory.h \
/usr/include/string.h /usr/include/strings.h /usr/include/c++/7/typeinfo \
/usr/include/c++/7/bits/exception.h /usr/include/c++/7/bits/hash_bytes.h \
/usr/include/c++/7/iostream /usr/include/c++/7/ostream \
/usr/include/c++/7/ios /usr/include/c++/7/iosfwd \
/usr/include/c++/7/bits/stringfwd.h /usr/include/c++/7/bits/memoryfwd.h \
/usr/include/c++/7/bits/postypes.h /usr/include/c++/7/cwchar \
/usr/include/wchar.h /usr/include/x86_64-linux-gnu/bits/wchar.h \
/usr/include/x86_64-linux-gnu/bits/types/wint_t.h \
/usr/include/x86_64-linux-gnu/bits/types/mbstate_t.h \
/usr/include/c++/7/exception /usr/include/c++/7/bits/exception_ptr.h \
/usr/include/c++/7/bits/exception_defines.h \
/usr/include/c++/7/bits/cxxabi_init_exception.h /usr/include/c++/7/new \
/usr/include/c++/7/bits/nested_exception.h \
/usr/include/c++/7/bits/move.h /usr/include/c++/7/bits/concept_check.h \
/usr/include/c++/7/type_traits /usr/include/c++/7/bits/char_traits.h \
/usr/include/c++/7/bits/stl_algobase.h \
/usr/include/c++/7/bits/functexcept.h \
/usr/include/c++/7/bits/cpp_type_traits.h \
/usr/include/c++/7/ext/type_traits.h \
/usr/include/c++/7/ext/numeric_traits.h \
/usr/include/c++/7/bits/stl_pair.h \
/usr/include/c++/7/bits/stl_iterator_base_types.h \
/usr/include/c++/7/bits/stl_iterator_base_funcs.h \
/usr/include/c++/7/debug/assertions.h \
/usr/include/c++/7/bits/stl_iterator.h \
/usr/include/c++/7/bits/ptr_traits.h /usr/include/c++/7/debug/debug.h \
/usr/include/c++/7/bits/predefined_ops.h /usr/include/c++/7/cstdint \
/usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h /usr/include/stdint.h \
/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
/usr/include/c++/7/bits/localefwd.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/c++locale.h \
/usr/include/c++/7/clocale /usr/include/locale.h \
/usr/include/x86_64-linux-gnu/bits/locale.h /usr/include/c++/7/cctype \
/usr/include/ctype.h /usr/include/c++/7/bits/ios_base.h \
/usr/include/c++/7/ext/atomicity.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/gthr.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h \
/usr/include/pthread.h /usr/include/sched.h \
/usr/include/x86_64-linux-gnu/bits/sched.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_sched_param.h \
/usr/include/x86_64-linux-gnu/bits/cpu-set.h /usr/include/time.h \
/usr/include/x86_64-linux-gnu/bits/time.h \
/usr/include/x86_64-linux-gnu/bits/timex.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h \
/usr/include/x86_64-linux-gnu/bits/setjmp.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/atomic_word.h \
/usr/include/c++/7/bits/locale_classes.h /usr/include/c++/7/string \
/usr/include/c++/7/bits/allocator.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h \
/usr/include/c++/7/ext/new_allocator.h \
/usr/include/c++/7/bits/ostream_insert.h \
/usr/include/c++/7/bits/cxxabi_forced.h \
/usr/include/c++/7/bits/stl_function.h \
/usr/include/c++/7/backward/binders.h \
/usr/include/c++/7/bits/range_access.h \
/usr/include/c++/7/initializer_list \
/usr/include/c++/7/bits/basic_string.h \
/usr/include/c++/7/ext/alloc_traits.h \
/usr/include/c++/7/bits/alloc_traits.h \
/usr/include/c++/7/ext/string_conversions.h /usr/include/c++/7/cstdio \
/usr/include/c++/7/cerrno /usr/include/errno.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/include/x86_64-linux-gnu/bits/types/error_t.h \
/usr/include/c++/7/bits/functional_hash.h \
/usr/include/c++/7/bits/basic_string.tcc \
/usr/include/c++/7/bits/locale_classes.tcc \
/usr/include/c++/7/system_error \
/usr/include/x86_64-linux-gnu/c++/7/bits/error_constants.h \
/usr/include/c++/7/stdexcept /usr/include/c++/7/streambuf \
/usr/include/c++/7/bits/streambuf.tcc \
/usr/include/c++/7/bits/basic_ios.h \
/usr/include/c++/7/bits/locale_facets.h /usr/include/c++/7/cwctype \
/usr/include/wctype.h /usr/include/x86_64-linux-gnu/bits/wctype-wchar.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/ctype_base.h \
/usr/include/c++/7/bits/streambuf_iterator.h \
/usr/include/x86_64-linux-gnu/c++/7/bits/ctype_inline.h \
/usr/include/c++/7/bits/locale_facets.tcc \
/usr/include/c++/7/bits/basic_ios.tcc \
/usr/include/c++/7/bits/ostream.tcc /usr/include/c++/7/istream \
/usr/include/c++/7/bits/istream.tcc /usr/include/c++/7/sstream \
/usr/include/c++/7/bits/sstream.tcc /usr/include/c++/7/algorithm \
/usr/include/c++/7/utility /usr/include/c++/7/bits/stl_relops.h \
/usr/include/c++/7/bits/stl_algo.h \
/usr/include/c++/7/bits/algorithmfwd.h \
/usr/include/c++/7/bits/stl_heap.h /usr/include/c++/7/bits/stl_tempbuf.h \
/usr/include/c++/7/bits/stl_construct.h \
/usr/include/c++/7/bits/uniform_int_dist.h /usr/include/c++/7/limits \
/usr/include/c++/7/iterator /usr/include/c++/7/bits/stream_iterator.h \
/usr/include/c++/7/memory /usr/include/c++/7/bits/stl_uninitialized.h \
/usr/include/c++/7/bits/stl_raw_storage_iter.h \
/usr/include/c++/7/ext/concurrence.h \
/usr/include/c++/7/bits/uses_allocator.h \
/usr/include/c++/7/bits/unique_ptr.h /usr/include/c++/7/tuple \
/usr/include/c++/7/array /usr/include/c++/7/bits/invoke.h \
/usr/include/c++/7/bits/shared_ptr.h \
/usr/include/c++/7/bits/shared_ptr_base.h \
/usr/include/c++/7/bits/allocated_ptr.h \
/usr/include/c++/7/bits/refwrap.h \
/usr/include/c++/7/ext/aligned_buffer.h \
/usr/include/c++/7/bits/shared_ptr_atomic.h \
/usr/include/c++/7/bits/atomic_base.h \
/usr/include/c++/7/bits/atomic_lockfree_defines.h \
/usr/include/c++/7/backward/auto_ptr.h /usr/include/c++/7/vector \
/usr/include/c++/7/bits/stl_vector.h \
/usr/include/c++/7/bits/stl_bvector.h /usr/include/c++/7/bits/vector.tcc \
/usr/include/c++/7/queue /usr/include/c++/7/deque \
/usr/include/c++/7/bits/stl_deque.h /usr/include/c++/7/bits/deque.tcc \
/usr/include/c++/7/bits/stl_queue.h /usr/include/c++/7/stack \
/usr/include/c++/7/bits/stl_stack.h /usr/include/c++/7/set \
/usr/include/c++/7/bits/stl_tree.h /usr/include/c++/7/bits/stl_set.h \
/usr/include/c++/7/bits/stl_multiset.h /usr/include/c++/7/map \
/usr/include/c++/7/bits/stl_map.h /usr/include/c++/7/bits/stl_multimap.h \
/usr/include/x86_64-linux-gnu/sys/times.h /usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h \
/usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
/usr/include/x86_64-linux-gnu/bits/getopt_core.h /usr/include/ucontext.h \
/usr/include/x86_64-linux-gnu/bits/indirect-return.h \
/usr/include/x86_64-linux-gnu/sys/ucontext.h \
/usr/include/x86_64-linux-gnu/bits/types/stack_t.h /usr/include/setjmp.h \
test/../relacy/relacy_std.hpp test/../relacy/relacy.hpp \
test/../relacy/base.hpp test/../relacy/pch.hpp \
test/../relacy/platform.hpp test/../relacy/defs.hpp \
test/../relacy/context.hpp test/../relacy/thread_local_ctx.hpp \
test/../relacy/test_params.hpp test/../relacy/test_result.hpp \
test/../relacy/context_base.hpp test/../relacy/history.hpp \
test/../relacy/memory.hpp test/../relacy/slab_allocator.hpp \
test/../relacy/random.hpp test/../relacy/foreach.hpp \
test/../relacy/thread_base.hpp test/../relacy/context_addr_hash.hpp \
test/../relacy/thread.hpp test/../relacy/dyn_thread_ctx.hpp \
test/../relacy/waitset.hpp test/../relacy/sync_var.hpp \
test/../relacy/stdlib/semaphore.hpp test/../relacy/stdlib/../base.hpp \
test/../relacy/stdlib/../context_base.hpp \
test/../relacy/stdlib/../sync_var.hpp \
test/../relacy/stdlib/../waitset.hpp \
test/../relacy/stdlib/../signature.hpp test/../relacy/stdlib/../base.hpp \
test/../relacy/stdlib/../test_result.hpp \
test/../relacy/stdlib/../context_base.hpp test/../relacy/test_suite.hpp \
test/../relacy/memory_order.hpp test/../relacy/random_scheduler.hpp \
test/../relacy/scheduler.hpp test/../relacy/full_search_scheduler.hpp \
test/../relacy/context_bound_scheduler.hpp \
test/../relacy/context_base_impl.hpp test/../relacy/backoff.hpp \
test/../relacy/atomic_fence.hpp test/../relacy/atomic.hpp \
test/../relacy/signature.hpp test/../relacy/atomic_events.hpp \
test/../relacy/rmw.hpp test/../relacy/var.hpp \
test/../relacy/thread_local.hpp test/../relacy/dyn_thread.hpp \
test/../relacy/stdlib/mutex.hpp test/../relacy/stdlib/../context.hpp \
test/../relacy/stdlib/../thread.hpp test/../relacy/stdlib/../atomic.hpp \
test/../relacy/stdlib/../foreach.hpp test/../relacy/stdlib/semaphore.hpp \
test/../relacy/stdlib/condition_variable.hpp \
test/../relacy/stdlib/event.hpp test/../relacy/stdlib/windows.hpp \
test/../relacy/stdlib/mutex.hpp \
test/../relacy/stdlib/condition_variable.hpp \
test/../relacy/stdlib/event.hpp test/../relacy/stdlib/pthread.hpp \
test/memory_order.hpp test/fence.hpp test/data_race.hpp test/mutex.hpp \
test/condvar.hpp test/semaphore.hpp test/event.hpp test/scheduler.hpp \
test/compare_swap.hpp test/wfmo.hpp test/thread_local.hpp \
test/../relacy/relacy.hpp test/dyn_thread.hpp \
test/../relacy/dyn_thread.hpp test/memory.hpp test/pthread.hpp \
test/../relacy/pthread.h test/windows.hpp test/../relacy/windows.h \
test/addr_hash.hpp test/futex.hpp /usr/include/c++/7/climits
Thanks for reply. Will think about it.
This error does not arise with libc++, so stdlib=libc++
may be a workaround.
Hi Дмитрий,
Thank you for such tool and your efforts, really nice... However I'm not able to compile any of the examples.
The invoking
make all
org++ -I. test1.cpp
leads to~/_cworkspace/relacy# g++ -I. test1.cpp In file included from test1.cpp:1:0: ./relacy/relacy_std.hpp:22:15: error: ‘memory_order’ is already declared in this scope using rl::memory_order; ^~~~~~~~~~~~ ./relacy/relacy_std.hpp:30:15: error: ‘atomic’ is already declared in this scope using rl::atomic; ^~~~~~ test1.cpp: In member function ‘void race_test::thread(unsigned int)’: test1.cpp:22:51: error: no matching function for call to ‘rl::atomic_proxy<int>::store(int, rl::memory_order, rl::debug_info)’ a($).store(1, rl::memory_order_relaxed); ^ In file included from ./relacy/relacy.hpp:22:0, from ./relacy/relacy_std.hpp:17, from test1.cpp:1: ./relacy/atomic.hpp:78:10: note: candidate: void rl::atomic_proxy<T>::store(T, rl::memory_order) [with T = int] void store(T value, memory_order mo = mo_seq_cst) ^~~~~ ./relacy/atomic.hpp:78:10: note: candidate expects 2 arguments, 3 provided test1.cpp:26:56: error: no matching function for call to ‘rl::atomic_proxy<int>::load(rl::memory_order, rl::debug_info)’ if (1 == a($).load(rl::memory_order_relaxed)) ^ In file included from ./relacy/relacy.hpp:22:0, from ./relacy/relacy_std.hpp:17, from test1.cpp:1: ./relacy/atomic.hpp:47:7: note: candidate: T rl::atomic_proxy_const<T>::load(rl::memory_order) const [with T = int] T load(memory_order mo = mo_seq_cst) const ^~~~ ./relacy/atomic.hpp:47:7: note: candidate expects 1 argument, 2 provided
Not sure what to do. Could you mind to help, thank you in advance...
gcc version below...
gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 Copyright (C) 2017 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.
test file from your discription for 'relacy'
#include <relacy/relacy_std.hpp> // template parameter '2' is number of threads struct race_test : rl::test_suite<race_test, 2> { std::atomic<int> a; rl::var<int> x; // executed in single thread before main thread function void before() { a($) = 0; x($) = 0; } // main thread function void thread(unsigned thread_index) { if (0 == thread_index) { x($) = 1; a($).store(1, rl::memory_order_relaxed); } else { if (1 == a($).load(rl::memory_order_relaxed)) x($) = 2; } } // executed in single thread after main thread function void after() { } // executed in single thread after every 'visible' action in main threads // disallowed to modify any state void invariant() { } }; int main() { rl::simulate<race_test>(); }
Hello
Has the problem been solved now?
Can you share the solution?
Has the problem been solved now?
I don't see any PRs referencing this issue. If this still happens on HEAD, it's not solved.
This happens on all compilers now, because some/most header pulls in the atomic header The solution is simple just abandon your hack of overriding std:: and just have the users change their code to use rl:: or using namespace rl; or some thing like that. It's too slow to use relacy on a large scale anyways, but it is very useful to vet a small data structure.
test/main.cpp
test suite using GCC-11/Clang-18 on a Linux based x86_64 system. #19 should address Apple Clang. Both PRs contain fixes to allow "faking" a minimum of the standard library headers (<atomic>
in particular).On Thu, Oct 5, 2023 at 12:09 PM Arne Schober @.***> wrote:
This happens on all compilers now, because some/most header pulls in The solution is simple just abandon your hack of overriding std:: and just have the users change their code to use rl:: or using namespace rl; or some thing like that.Message ID: @.*** com>
[...]
That is what I do now. Seems to work like a charm.
Hi Дмитрий,
Thank you for such tool and your efforts, really nice... However I'm not able to compile any of the examples.
The invoking
make all
org++ -I. test1.cpp
leads toNot sure what to do. Could you mind to help, thank you in advance...
gcc version below...
test file from your discription for 'relacy'