This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/23242] New: Invalid %sil register chosen when dereferenced pointer used in inline asm with -O0
- From: "ianw at gelato dot unsw dot edu dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Aug 2005 00:32:09 -0000
- Subject: [Bug inline-asm/23242] New: Invalid %sil register chosen when dereferenced pointer used in inline asm with -O0
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
See the following snippet
ianw@morrison:~$ gcc-snap -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,obj-c++,ada,treelang
--prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --disable-nls
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--with-java-home=/usr/lib/gcc-snapshot/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror i486-linux-gnu
Thread model: posix
gcc version 4.1.0 20050719 (experimental)
ianw@morrison:~$ cat test.c
int main()
{
volatile unsigned char old, new, *newp;
newp = &new;
/* this one works OK */
__asm__ __volatile__("xchgb %0, %1"
: "=r"(old), "=m"(new)
: "0"(0xff), "m"(new) : "memory");
#ifdef DEREF
/* this one doesn't */
__asm__ __volatile__("xchgb %0, %1"
: "=r"(old), "=m"(*newp)
: "0"(0xff), "m"(*newp) : "memory");
#endif
return 0;
}
ianw@morrison:~$ gcc-snap -Wall -o test test.c
ianw@morrison:~$ gcc-snap -DDEREF -Wall -o test test.c
/tmp/cc8YTeKG.s: Assembler messages:
/tmp/cc8YTeKG.s:30: Error: bad register name `%sil'
ianw@morrison:~$ gcc-snap -O2 -DDEREF -Wall -o test test.c
I believe this to be the cause of Debian bug #321291
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=321291) filed against the
libatomic_ops package (original author CC'd)
--
Summary: Invalid %sil register chosen when dereferenced pointer
used in inline asm with -O0
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ianw at gelato dot unsw dot edu dot au
CC: Hans dot Boehm at hp dot com,gcc-bugs at gcc dot gnu dot
org
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23242