This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Code produced with -fPIC reserves EBX, but compiles bad __asm__ anyway


[The following bug report was submitted to the Debian BTS;
 same behaviour for gcc-20001008.
 Please CC 73065@bugs.debian.org on replies]



Package: gcc
Version: 1:2.95.2-13
Severity: normal

Greetings!  Both files should fail to compile with the same warning.
I've produced verifiably incorrect asm code using the latter syntax.

intech20:/tmp$ cat foo.c
int
main(int argc,char * argv[]) {

  int i=0;

  __asm__ __volatile__ ("addl $1,%%ebx\n\t" : : "b" (i));

}
intech20:/tmp$ cc -fPIC foo.c -o foo
foo.c: In function `main':
foo.c:6: Invalid `asm' statement:
foo.c:6: fixed or forbidden register 3 (bx) was spilled for class BREG.
intech20:/tmp$ cat foo1.c
int
main(int argc,char * argv[]) {

  int i=0;

  __asm__ __volatile__ ("addl $1,%%ebx\n\t" : : "a" (i) : "ebx");

}
intech20:/tmp$ cc -fPIC foo1.c -o foo
intech20:/tmp$ 


-- System Information
Debian Release: 2.2
Kernel Version: Linux intech20 2.2.16 #1 SMP Tue Aug 8 17:17:46 EDT 2000 i686 unknown

Versions of the packages gcc depends on:
ii  binutils       2.9.5.0.37-1   The GNU assembler, linker and binary utiliti
ii  cpp            2.95.2-13      The GNU C preprocessor.
ii  libc6          2.1.3-10       GNU C Library: Shared libraries and Timezone



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]