[Bug inline-asm/15312] New: "+m" constraint gives strange warnings
gcc-bugzilla at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu May 6 10:43:00 GMT 2004
When compiling the attached code with gcc-3.4, the following warnings
are now displayed:
xxx.c: In function `__down_read_trylock':
xxx.c:9: warning: read-write constraint does not allow a register
xxx.c:9: warning: read-write constraint does not allow a register
This does not happen with gcc-3.3; and I believe no warnings were generated for
earlier gcc-3.x's.
The attached code is an excerpt from include/asm-i386/rwsem.h in the Linux
kernel.
Environment:
System: Linux warthog.cambridge.redhat.com 2.4.22-1.2149.nptl #1 Wed Jan 7 12:57:33 EST 2004 i686 athlon i386 GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --prefix=/opt/gcc-34 : (reconfigured) ./configure --prefix=/opt/gcc-34
How-To-Repeat:
Compile the following bit of code with an x86 compiler capable of
handling the CMPXCHG instruction (i486+). No special flags are required.
struct rw_semaphore {
signed long count;
};
int __down_read_trylock(struct rw_semaphore *sem)
{
signed long result, tmp;
__asm__ __volatile__(
"# beginning __down_read_trylock\n\t"
" movl %0,%1\n\t"
"1:\n\t"
" movl %1,%2\n\t"
" addl %3,%2\n\t"
" jle 2f\n\t"
"lock;" " cmpxchgl %2,%0\n\t"
" jnz 1b\n\t"
"2:\n\t"
"# ending __down_read_trylock\n\t"
: "+m"(sem->count), "=&a"(result), "=&r"(tmp)
: "i"(0x00000001)
: "memory", "cc"
);
return result >= 0 ? 1 : 0;
}
--
Summary: "+m" constraint gives strange warnings
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dhowells at redhat dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15312
More information about the Gcc-bugs
mailing list