The following program:
---&<---
static volatile long last;
main()
{
long a, b;
a = last;
b = a + 1;
asm volatile ("casx %0, %2, %1\n" : "+V" (last), "+r" (b) :"r" (a));
}
--->&---
will not compile. The error message printed is:
[EMAIL PROTECTED]:~/x$ /usr/local/sparc64/bin/sparc64-linux-gnu-gcc -c test.c
test.c: In function 'main':
test.c:9: error: inconsistent operand constraints in an 'asm'
Even though the use of the "m" constraint will fix this testcase, "m" cannot be
used in general, because it allows the operand to be offsetable. The casx
instruction will not tolerate an offset. According to gcc info page, "V" should
be just like "m", but not offsetable. Wonder why "V" does not work when "m"
does in this case.
Moreover, there are more or less ugly workarounds for this, but this has been
bugging me for some time and I think it should be fixed.
The gcc has been configured using:
configure --target=sparc64-linux-gnu --prefix=/usr/local/sparc64
--program-prefix=sparc64-linux-gnu- --with-gnu-as --with-gnu-ld --disable-nls
--disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib
--disable-libgcj --without-headers --disable-shared
Thanks,
Jakub
--
Summary: "V" inline asm constraint not working on sparc64
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at jermar dot eu
GCC build triplet: 4.3.1
GCC host triplet: i486-linux-gnu
GCC target triplet: sparc64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36558