Boost C++ Libraries: Ticket #3750: atomic_cas32 not working for Sun Solaris 10 https://svn.boost.org/trac10/ticket/3750 <p> #include &lt;iostream&gt; #include "boost/interprocess/detail/atomic.hpp" </p> <p> boost::uint32_t m_contextId = 0; long rtIncrContextId() { </p> <blockquote> <p> boost::uint32_t contextId = -1; boost::uint32_t oldValue = -1; do { </p> <blockquote> <p> oldValue = m_contextId; contextId = m_contextId + 1; if(boost::interprocess::detail::atomic_cas32((volatile boost::uint32_t *)&amp;m_contextId,contextId,oldValue) == oldValue) </p> <blockquote> <p> break; </p> </blockquote> </blockquote> <p> }while (true); return contextId; </p> </blockquote> <p> } </p> <p> int main() { </p> <blockquote> <p> std::cout &lt;&lt; " \n Value of m_contextId " &lt;&lt; m_contextId; </p> </blockquote> <blockquote> <p> rtIncrContextId(); </p> </blockquote> <blockquote> <p> std::cout &lt;&lt; " \n Value of m_contextId " &lt;&lt; m_contextId &lt;&lt; std::endl; </p> </blockquote> <p> } <strong> 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</strong> <em>#elif defined(<span class="underline">GNUC</span>) &amp;&amp; ( <span class="underline">GNUC</span> * 100 + <span class="underline">GNUC_MINOR</span> &gt;= 401 ) </em></p> <hr /> <hr /> <p> inline boost::uint32_t atomic_cas32 </p> <blockquote> <p> (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) </p> </blockquote> <p> { return <span class="underline">sync_val_compare_and_swap(const_cast&lt;boost::uint32_t *&gt;(mem), with, cmp); }<em> </em></span></p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3750 Trac 1.4.3 Ion Gaztañaga Fri, 01 Apr 2011 21:39:42 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3750#comment:1 https://svn.boost.org/trac10/ticket/3750#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Sorry but I can find a solution for this without help and a patch. I will pass this to wontfix until then. </p> Ticket Maciej Bliziński <maciej@…> Tue, 06 Mar 2012 16:22:18 GMT <link>https://svn.boost.org/trac10/ticket/3750#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3750#comment:2</guid> <description> <p> What was your solution? Set instruction-set to v9? </p> </description> <category>Ticket</category> </item> <item> <author>xmatto79@…</author> <pubDate>Wed, 14 Mar 2012 10:42:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3750#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3750#comment:3</guid> <description> <p> I have a similar problem compiling my program under Solaris10. If I just declare a named_upgradable_mutex like this: </p> <p> named_upgradable_mutex n_u_mutex(open_or_create, "ipc_pri_queue_upgradable_mutex"); </p> <p> I get the error: </p> <p> 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&lt;<a class="missing wiki">DeviceAbstraction</a>, <a class="missing wiki">MemAlignment</a>, <a class="missing wiki">FileBased</a>, <a class="missing wiki">StoreDevice</a>&gt;::priv_open_or_create(boost::interprocess::ipcdetail::create_enum_t, const typename boost::interprocess::managed_open_or_create_impl_device_id_t&lt;<a class="missing wiki">DeviceAbstraction</a>&gt;::type&amp;, size_t, boost::interprocess::mode_t, const void*, const boost::interprocess::permissions&amp;, <a class="missing wiki">ConstructFunc</a>) [with <a class="missing wiki">ConstructFunc</a> = boost::interprocess::ipcdetail::named_creation_functor&lt;boost::interprocess::interprocess_upgradable_mutex, boost::interprocess::ipcdetail::named_creation_functor_no_arg&gt;, <a class="missing wiki">DeviceAbstraction</a> = boost::interprocess::shared_memory_object, unsigned int <a class="missing wiki">MemAlignment</a> = 0u, bool <a class="missing wiki">FileBased</a> = true, bool <a class="missing wiki">StoreDevice</a> = 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 &lt;URL:http://forum.java.sun.com/forum.jspa?forumID=905&gt; for instructions. <strong>* Error code 1 make: Fatal error: Command failed for target `main.o' </strong></p> <p> I'm using GCC: sparc-sun-solaris2.10-g++ (GCC) 4.2.1 (20090222) (gccfss) </p> <p> Is there a solution to this? </p> </description> <category>Ticket</category> </item> </channel> </rss>