Skip to content

Compilation error - GCC 7.4.0 #13

@m-chichikalov

Description

@m-chichikalov

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 or g++ -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>();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions