From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10896 invoked by alias); 19 Mar 2003 17:36:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 10850 invoked by uid 71); 19 Mar 2003 17:36:00 -0000 Resent-Date: 19 Mar 2003 17:36:00 -0000 Resent-Message-ID: <20030319173600.10848.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, etienne.lorrain@masroudeau.com Received: (qmail 3750 invoked by uid 48); 19 Mar 2003 17:34:38 -0000 Message-Id: <20030319173438.3749.qmail@sources.redhat.com> Date: Wed, 19 Mar 2003 17:36:00 -0000 From: etienne.lorrain@masroudeau.com Reply-To: etienne.lorrain@masroudeau.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: inline-asm/10153: selection of %dil or %sil on ia32 arch by valid C source X-SW-Source: 2003-03/txt/msg01279.txt.bz2 List-Id: >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: