Modify

Ticket #3750 (closed Bugs: wontfix)

Opened 4 years ago

Last modified 2 years ago

atomic_cas32 not working for Sun Solaris 10

Reported by: SAURABH PANDEY <saurabh.pandey@…> Owned by: igaztanaga
Milestone: Boost 1.42.0 Component: interprocess
Version: Boost 1.40.0 Severity: Problem
Keywords: atomic_cas32 on Sun solaris 10 Cc: saurabh.pandey@…

Description

#include <iostream> #include "boost/interprocess/detail/atomic.hpp"

boost::uint32_t m_contextId = 0; long rtIncrContextId() {

boost::uint32_t contextId = -1; boost::uint32_t oldValue = -1; do {

oldValue = m_contextId; contextId = m_contextId + 1; if(boost::interprocess::detail::atomic_cas32((volatile boost::uint32_t *)&m_contextId,contextId,oldValue) == oldValue)

break;

}while (true); return contextId;

}

int main() {

std::cout << " \n Value of m_contextId " << m_contextId;

rtIncrContextId();

std::cout << " \n Value of m_contextId " << m_contextId << std::endl;

} The above program is not working on sun solaris 10 using sparc. g++ version is 4.4.2 and because of this sun sparc specific atomic operation are not being used . Instead following function is used #elif defined(GNUC) && ( GNUC * 100 + GNUC_MINOR >= 401 )



inline boost::uint32_t atomic_cas32

(volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp)

{ return sync_val_compare_and_swap(const_cast<boost::uint32_t *>(mem), with, cmp); }

Attachments

Change History

comment:1 Changed 3 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to wontfix

Sorry but I can find a solution for this without help and a patch. I will pass this to wontfix until then.

comment:2 Changed 2 years ago by Maciej Bliziński <maciej@…>

What was your solution? Set instruction-set to v9?

comment:3 Changed 2 years ago by xmatto79@…

I have a similar problem compiling my program under Solaris10. If I just declare a named_upgradable_mutex like this:

named_upgradable_mutex n_u_mutex(open_or_create, "ipc_pri_queue_upgradable_mutex");

I get the error:

g++ -O3 -I /usr/local/boost_1_49_0 -c main.cpp -o main.o /usr/local/boost_1_49_0/boost/interprocess/detail/atomic.hpp: In member function 'void boost::interprocess::ipcdetail::managed_open_or_create_impl<DeviceAbstraction?, MemAlignment?, FileBased?, StoreDevice?>::priv_open_or_create(boost::interprocess::ipcdetail::create_enum_t, const typename boost::interprocess::managed_open_or_create_impl_device_id_t<DeviceAbstraction?>::type&, size_t, boost::interprocess::mode_t, const void*, const boost::interprocess::permissions&, ConstructFunc?) [with ConstructFunc? = boost::interprocess::ipcdetail::named_creation_functor<boost::interprocess::interprocess_upgradable_mutex, boost::interprocess::ipcdetail::named_creation_functor_no_arg>, DeviceAbstraction? = boost::interprocess::shared_memory_object, unsigned int MemAlignment? = 0u, bool FileBased? = true, bool StoreDevice? = true]': /usr/local/boost_1_49_0/boost/interprocess/detail/atomic.hpp:316: internal compiler error: in rewrite_stmt, at tree-into-ssa.c:1380 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://forum.java.sun.com/forum.jspa?forumID=905> for instructions. * Error code 1 make: Fatal error: Command failed for target `main.o'

I'm using GCC: sparc-sun-solaris2.10-g++ (GCC) 4.2.1 (20090222) (gccfss)

Is there a solution to this?

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.