http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53899

             Bug #: 53899
           Summary: [C++0x] undefined reference to
                    std::atomic<boost::lockfree::detail::tagged_ptr...
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: nnel...@infowest.com


Thank you for your constantly used GCC compiler.

boost lockfree and boost atomic have been accepted by boost and should shortly
be in the boost distribution. The current programs are available at

http://tim.klingt.org/boost_lockfree.tar.gz

The following program when compiled and executed from libs/lockfree/test
(including the other required boost distribution components), a folder in the
prior gz, will work OK using

g++ bench_3.cpp -o bench_3

but gives errors of the following kind when using 

g++ -std=c++0x bench_3.cpp -o bench_3

undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::fifo<long,
boost::lockfree::caching_freelist_t, std::allocator<long> >::node>
>::load(std::memory_order) const'

undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::fifo<long,
boost::lockfree::caching_freelist_t, std::allocator<long> >::node>
>::compare_exchange_weak(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::fifo<long,
boost::lockfree::caching_freelist_t, std::allocator<long> >::node>&,
boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::fifo<long,
boost::lockfree::caching_freelist_t, std::allocator<long> >::node>,
std::memory_order)'

undefined reference to
`std::atomic<boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::fifo<long,
boost::lockfree::caching_freelist_t, std::allocator<long> >::node>
>::store(boost::lockfree::detail::tagged_ptr<boost::lockfree::detail::fifo<long,
boost::lockfree::caching_freelist_t, std::allocator<long> >::node>,
std::memory_order)'

This item may be along the line given in

Bug 49445 [C++0x] Undefined reference to std::atomic<float> "operator float"

Thank you.

Neil

----------------
// bench_3.cpp
#include "../../../boost/lockfree/fifo.hpp"

int elements = 100;
int iterations = 50;

#define FIFO \
    boost::lockfree::fifo<long> f(elements);

#define FIFO_FULL \
    boost::lockfree::fifo<long> f(elements); \
    for (int i = 0; i != elements; ++i) \
        f.enqueue_unsafe(i); \

__attribute__ ((noinline))
__attribute__ ((flatten))
void test_fifo_push(void)
{
    FIFO
    for (int i = 0; i != elements; ++i)
        f.enqueue(i);
}

__attribute__ ((noinline))
__attribute__ ((flatten))
void test_fifo_pop(void)
{
    FIFO_FULL
    long out;
    for (int i = 0; i != elements; ++i)
        f.dequeue(out);
}

int main()
{
    for (int i = 0; i != iterations; ++i)
        test_fifo_push();

    for (int i = 0; i != iterations; ++i)
        test_fifo_pop();
}

Reply via email to