inline-asm/10153: selection of %dil or %sil on ia32 arch by valid C source

etienne.lorrain@masroudeau.com etienne.lorrain@masroudeau.com
Wed Mar 19 18:25:00 GMT 2003


>Number:         10153
>Category:       inline-asm
>Synopsis:       selection of %dil or %sil on ia32 arch by valid C source
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 19 17:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Etienne Lorrain
>Release:        gcc version 3.2.3 20030309 (Debian prerelease)
>Organization:
>Environment:
Linux Debian ia32
>Description:
Just compile this, and look at the comment
"automatic size decision there"
(lots of comment removed and macro expanded...)
Works up to gcc-3.0.4, not after 3.1

etienne@fulbert:~/gcc/gujin$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.3 20030309 (Debian prerelease)
etienne@fulbert:~/gcc/gujin$
etienne@fulbert:~/gcc/gujin$ cat user.i
extern unsigned char VGA_valid_mode[];

extern inline unsigned
divrem8 (unsigned short oper, unsigned char *rem)
  {
  unsigned divider;

  asm (
"       aam     $8                      # operand in ax         \n"
"       movb    %%al,%%cl               # remainder             \n"
"       movzbl  %%ah,%%eax              # divider               \n"
        : "=a" (divider), "=c" (*rem) : "a" (oper) );
  return divider;
  }

extern inline void VIDEO_mode_invalidate (unsigned char mode)
  {

  unsigned char shift;
  unsigned index = divrem8 (mode, &shift);
  unsigned char tmp = ({
         typeof (VGA_valid_mode[index]) returned;
         asm volatile (
 "      # automatic size decision there:        \n"
 "      mov     %%cs:%a1,%0                     \n"
         : "=r" (returned) : "g" (&VGA_valid_mode[index]));
         returned; }) & ~(1 << shift);

  asm volatile (
 "      movb    %b0,%%cs:%a1            \n"
        : : "qi" (tmp), "r" (&VGA_valid_mode[index])
        );
  }

void VGA_init (void)
  {
  extern char tmpstatictable[15];
  unsigned i;

  for (i = 0; i <= 0x7F; i++) {
      unsigned char shift;
      unsigned short offset = divrem8 (i, &shift);

      if ((tmpstatictable[offset] & (1 << shift)) == 0)
          VIDEO_mode_invalidate (i);
      }
  }
etienne@fulbert:~/gcc/gujin$ gcc -Os user.i
/tmp/ccWPbdd5.s: Assembler messages:
/tmp/ccWPbdd5.s:35: Error: bad register name `%sil'
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list