[PATCH][2.6.7-rc2] gcc-3.4.0 warning in i386 __down_read_trylock()

From: Mikael Pettersson
Date: Sun May 30 2004 - 05:48:18 EST


The i386 __down_read_trylock() code contains a "+m" asm
constraint, which triggers warnings from gcc-3.4.0:

gcc -Wp,-MD,fs/xfs/.xfs_iget.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -msoft-float -mpreferred-stack-boundary=2 -fno-unit-at-a-time -march=k8 -Iinclude/asm-i386/mach-default -O2 -fomit-frame-pointer -Wdeclaration-after-statement -Ifs/xfs -Ifs/xfs/linux-2.6 -funsigned-char -DKBUILD_BASENAME=xfs_iget -DKBUILD_MODNAME=xfs -c -o fs/xfs/xfs_iget.o fs/xfs/xfs_iget.c
include/asm/rwsem.h: In function `xfs_ilock_nowait':
include/asm/rwsem.h:126: warning: read-write constraint does not allow a register
include/asm/rwsem.h:126: warning: read-write constraint does not allow a register
include/asm/rwsem.h:126: warning: read-write constraint does not allow a register
include/asm/rwsem.h:126: warning: read-write constraint does not allow a register

Fixed by the patch below.

/Mikael

diff -ruN linux-2.6.7-rc2/include/asm-i386/rwsem.h linux-2.6.7-rc2.gcc340-fixes/include/asm-i386/rwsem.h
--- linux-2.6.7-rc2/include/asm-i386/rwsem.h 2003-03-08 17:22:32.000000000 +0100
+++ linux-2.6.7-rc2.gcc340-fixes/include/asm-i386/rwsem.h 2004-05-30 11:39:07.000000000 +0200
@@ -134,8 +134,8 @@
" jnz 1b\n\t"
"2:\n\t"
"# ending __down_read_trylock\n\t"
- : "+m"(sem->count), "=&a"(result), "=&r"(tmp)
- : "i"(RWSEM_ACTIVE_READ_BIAS)
+ : "=m"(sem->count), "=&a"(result), "=&r"(tmp)
+ : "i"(RWSEM_ACTIVE_READ_BIAS), "m"(sem->count)
: "memory", "cc");
return result>=0 ? 1 : 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/