From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15515 invoked by alias); 3 Mar 2003 01:26: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 15501 invoked by uid 71); 3 Mar 2003 01:26:00 -0000 Date: Mon, 03 Mar 2003 01:26:00 -0000 Message-ID: <20030303012600.15500.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Zack Weinberg Subject: Re: inline-asm/9910: gcc dies on inline assembly Reply-To: Zack Weinberg X-SW-Source: 2003-03/txt/msg00058.txt.bz2 List-Id: The following reply was made to PR inline-asm/9910; it has been noted by GNATS. From: Zack Weinberg To: jay@remotepoint.com Cc: gcc-gnats@gcc.gnu.org, gcc@sources.redhat.com, dies@sources.redhat.com Subject: Re: inline-asm/9910: gcc dies on inline assembly Date: Sun, 02 Mar 2003 17:19:31 -0800 jay@remotepoint.com writes: > will not compile very simple piece of inline assembly code. gcc-3.2 > gives an internal compiler error where gcc-2.95 gave invalid asm > statement (fixed or forbidden register 0 (ax) was spilled for class > AREG). From what I can find, the code should actually be legal. ... > int main() { > int foo=10, bar=15; > > __asm__ __volatile__ ("addl %%ebx,%%eax" > : "=eax"(foo) > : "eax"(foo),"ebx"(bar) > : "eax" > ); gcc should not ICE, but this is emphatically not correct code. A correct asm statement would read __asm__ ("addl %1, %0" : "+a" (foo) : "b" (bar)); or better (since there is no requirement for eax and ebx to be the registers used): __asm__ ("addl %1, %0" : "+r" (foo) : "r" (bar)); The difference between constraint strings and clobber lists is unfortunate and confusing, but no one has had a better idea. zw