Opened 8 years ago

Last modified 6 years ago

#10113 new Bugs

[1.55] no lock-free synchronization on Solaris 10 sparcv9 (sp_counted_base.hpp)

Reported by: anonymous Owned by: timblechmann
Milestone: To Be Determined Component: lockfree
Version: Boost 1.55.0 Severity: Problem
Keywords: lock-free sync. Cc:

Description

I wonder, why lock-free synchronization is not in use on solaris 10 (sparcv9).

E.g. check with http://www.boost.org/doc/libs/1_53_0/doc/html/lockfree/examples.html

When i build boost 1.55 with gcc-4.7.2, then i get for

./b2

[...]

  • lockfree boost::atomic_flag : no

But there seems to be some support for cas32 (e.g.) in ./include/boost/smart_ptr/detail/...

But in ./include/boost/smart_ptr/detail/sp_counted_base.hpp there is in the sequence of #if...#elif...#else...#endif is:

[...]
#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__)
# include <boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp>

#elif defined( BOOST_SP_HAS_SYNC )
# include <boost/smart_ptr/detail/sp_counted_base_sync.hpp>

#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) )
# include <boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp>
[...]

I.e. BOOST_SP_HAS_SYNC is preferred.

Is this correct?

  • many thanks!

best regards,

Frank

Change History (4)

comment:1 by anonymous, 8 years ago

The strange thing is: when i compile and execute the test module lockfree.cpp manually i get:

> g++ -o test -I../../../ lockfree.cpp
> ./test
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = char]'
atomic<char> is always lock free
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = short int]'
atomic<short> is always lock free
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = int]'
atomic<int> is always lock free
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = long int]'
atomic<long> is always lock free
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = long long int]'
atomic<long long> is always lock free
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = void*]'
atomic<void *> is always lock free
lockfree.cpp(29): test lock_free_macro_val == lock_free_expect failed in function: 'void verify_lock_free(const char*, int, int) [with T = bool]'
atomic<bool> is always lock free

**** 7 errors detected

So always saying "is always lock free" - but the verify_lock_free still fails?

rgds, Frank

comment:2 by anonymous, 8 years ago

i think the #ifdefs for solaris are wrong in lockfree.cpp.

In ./include/boost/smart_ptr/detail/sp_counted_base.hpp there is checked for

defined( __sparcv9 )

respectively

defined( __sparcv8 )

But in lockfree.cpp it's using

defined( __sparc_v9__)

(only).

This is misaligned.

But also the gcc is wrong (at least mine - could be wrong build):

it uses

__sparcv8

on a sparcv9 system

rgds, Frank

comment:3 by anonymous, 8 years ago

Forget about the last issue in previous comment.

Being recogized as either sparcv8 or sparcv9 is an issue of the compile flags - using 32bit or 64bit for compilation:

$ echo "" | /usr/local/gcc-4.7.2/bin/g++ -m32 -E -dM - | grep sparc
#define sparc 1
#define __sparc__ 1
#define __sparcv8 1
#define __sparc 1

$ echo "" | /usr/local/gcc-4.7.2/bin/g++ -m64 -E -dM - | grep sparc
#define sparc 1
#define __sparc__ 1
#define __sparcv9 1
#define __sparc 1

comment:4 by Kohei Takahashi, 6 years ago

Component: Building Boostlockfree
Owner: set to timblechmann
Note: See TracTickets for help on using tickets.