public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Zack Weinberg <zack@codesourcery.com>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: inline-asm/9910: gcc dies on inline assembly
Date: Mon, 03 Mar 2003 01:26:00 -0000	[thread overview]
Message-ID: <20030303012600.15500.qmail@sources.redhat.com> (raw)

The following reply was made to PR inline-asm/9910; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
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


             reply	other threads:[~2003-03-03  1:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03  1:26 Zack Weinberg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-11 21:28 hubicka
2003-03-03 23:46 Zack Weinberg
2003-03-03 23:16 Richard Henderson
2003-03-03  0:56 jay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030303012600.15500.qmail@sources.redhat.com \
    --to=zack@codesourcery.com \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).