Boost C++ Libraries: Ticket #12804: Can't compiler IPC atomic_cas32<> on AIX.ppc with GCC https://svn.boost.org/trac10/ticket/12804 <p> Hello, </p> <p> I'm trying to use boost::atomic&lt;&gt; on AIX.ppc (v7.1) box and compile code with GCC. But unfortunately, the code below fails to compile : </p> <hr /> <pre class="wiki">inline boost::uint32_t atomic_cas32 (volatile boost::uint32_t *mem, boost::uint32_t with, boost::uint32_t cmp) { boost::uint32_t prev; asm volatile ("1:\n\t"  "lwarx %0,0,%1\n\t" "cmpw %0,%3\n\t" "bne- 2f\n\t"  "stwcx. %2,0,%1\n\t" "bne- 1b\n\t"  "2:"  : "=&amp;r"(prev) : "b" (mem), "r" (with), "r" (cmp) : "cc", "memory"); return prev; } </pre><p> AIX assembler (/usr/bin/as) execution fails with error saying that "labels need to follow the symbol rules". Simple change from "1:\n\t" to "t_1:\n\t" fixes the issue. </p> <p> I have a question : <strong>Is boost::atomic&lt;&gt; is designed to be compiled with GCC on AIX.ppc ? Or should it be used only with native xlC compiler ?</strong> </p> <hr /> <p> Environment : </p> <pre class="wiki">-bash-4.3$ as -v as V7.1 -bash-4.3$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix7.1.0.0/4.8.5/lto-wrapper Target: powerpc-ibm-aix7.1.0.0 Configured with: ../gcc-4.8.5/configure --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --with-local-prefix=/opt/freeware --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --with-cloog=no --with-ppl=no --disable-libstdcxx-pch --enable-__cxa_atexit Thread model: aix gcc version 4.8.5 (GCC) -bash-4.3$ </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12804 Trac 1.4.3 anonymous Fri, 03 Feb 2017 09:53:46 GMT <link>https://svn.boost.org/trac10/ticket/12804#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12804#comment:1</guid> <description> <p> Sorry for confusing, the issue is realated to IPC atomic. Here is a simple case that doesn't compile : </p> <pre class="wiki">#include &lt;boost/interprocess/detail/atomic.hpp&gt; #include &lt;iostream&gt; int main() { boost::uint32_t o, i=0, w=1, c=2; o = boost::interprocess::ipcdetail::atomic_cas32(&amp;i,w,c); std::cout &lt;&lt; o &lt;&lt; '\n'; } </pre><p> and compile output : </p> <pre class="wiki">$ /opt/gcc494/bin/g++ -maix64 -mminimal-toc -pthread -B/opt/gcc494/bin/ -std=c++11 -fpermissive -O0 -g -Wall -Wextra -Wpedantic -Wno-unknown-pragmas -Wno-reorder -Wno-unused-parameter -Wno-unused-local-typedefs -Wno-unused-variable -Wno-ignored-qualifiers -Wno-sign-compare -D_HAS_CPP0X=1 -I/opt/boost/boost_1_62_0/distro/aix.ppc64/include -DWFMO -o minimal minimal.cpp Assembler: /tmp//ccGvRPiO.s: line 1128: 1252-142 Syntax error. /tmp//ccGvRPiO.s: line 1131: 1252-142 Syntax error. /tmp//ccGvRPiO.s: line 1133: 1252-142 Syntax error. /tmp//ccGvRPiO.s: line 1134: 1252-142 Syntax error. </pre> </description> <category>Ticket</category> </item> <item> <author>dima.ru.com@…</author> <pubDate>Fri, 03 Feb 2017 09:55:20 GMT</pubDate> <title>owner, version, component, summary changed https://svn.boost.org/trac10/ticket/12804#comment:2 https://svn.boost.org/trac10/ticket/12804#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">timblechmann</span> to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.63.0</span> → <span class="trac-field-new">Boost 1.62.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">atomic</span> → <span class="trac-field-new">interprocess</span> </li> <li><strong>summary</strong> <span class="trac-field-old">Can't compiler boost::atomic&lt;&gt; on AIX.ppc with GCC</span> → <span class="trac-field-new">Can't compiler IPC atomic_cas32&lt;&gt; on AIX.ppc with GCC</span> </li> </ul> Ticket Ion Gaztañaga Mon, 06 Feb 2017 13:02:17 GMT <link>https://svn.boost.org/trac10/ticket/12804#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12804#comment:3</guid> <description> <p> It seems that the problem is related with the assembler, the code assumes GNU as as those types of labels are typical.. I have no access to that platform so a patch from a user would be needed. Many atomic functions have a similar syntax. </p> </description> <category>Ticket</category> </item> <item> <author>dima.ru.com@…</author> <pubDate>Tue, 08 Aug 2017 07:12:45 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/12804 https://svn.boost.org/trac10/ticket/12804 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">atomic.hpp.diff</span> </li> </ul> <p> boost/interprocess/detail/atomic.hpp patch </p> Ticket dima.ru.com@… Tue, 08 Aug 2017 07:14:31 GMT <link>https://svn.boost.org/trac10/ticket/12804#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12804#comment:4</guid> <description> <p> Please, take a look at the attached patch being applied to fix compiler error. </p> </description> <category>Ticket</category> </item> </channel> </rss>