Opened 6 years ago
Last modified 5 years ago
#12804 new Bugs
Can't compiler IPC atomic_cas32<> on AIX.ppc with GCC
Reported by: | Owned by: | Ion Gaztañaga | |
---|---|---|---|
Milestone: | To Be Determined | Component: | interprocess |
Version: | Boost 1.62.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hello,
I'm trying to use boost::atomic<> on AIX.ppc (v7.1) box and compile code with GCC. But unfortunately, the code below fails to compile :
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:" : "=&r"(prev) : "b" (mem), "r" (with), "r" (cmp) : "cc", "memory"); return prev; }
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.
I have a question : Is boost::atomic<> is designed to be compiled with GCC on AIX.ppc ? Or should it be used only with native xlC compiler ?
Environment :
-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$
Attachments (1)
Change History (5)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Component: | atomic → interprocess |
---|---|
Owner: | changed from | to
Summary: | Can't compiler boost::atomic<> on AIX.ppc with GCC → Can't compiler IPC atomic_cas32<> on AIX.ppc with GCC |
Version: | Boost 1.63.0 → Boost 1.62.0 |
comment:3 by , 6 years ago
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.
comment:4 by , 5 years ago
Please, take a look at the attached patch being applied to fix compiler error.
Sorry for confusing, the issue is realated to IPC atomic. Here is a simple case that doesn't compile :
and compile output :