public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jie Zhang <zhangjie@magima.com.cn>
To: gcc@gcc.gnu.org
Subject: An error of gcc-ss-20030303
Date: Wed, 23 Apr 2003 10:36:00 -0000	[thread overview]
Message-ID: <3EA643B9.9090404@magima.com.cn> (raw)

The following code is copied from spinlock.c in uClibc (after 
preprocessing and 'inline' after static removed):

static void __pthread_release(int * spinlock)
{
  asm ("" : : : "memory");
  *spinlock = 0;
  __asm __volatile ("" : "=m" (*spinlock) : "0" (*spinlock));
}

When compiled using gcc-3.0.2, no error is reported. But gcc-3.2 and 
gcc-ss-20030303 report the follwing error:

t.c: In function `__pthread_release':
t.c:5: inconsistent operand constraints in an `asm'

I dump the rtl using -dr and find that gcc-3.0.2 uses a pseudo register 
to hold the address of 'spinlock' and the output operand and input 
operand of __asm__ use the same register. But gcc-ss-20030303 uses two 
pseudo registers for the output operand and input operand of __asm__ 
respectively, both pseudo registers hold the same value -- the address 
of 'spinlock'. Then when checking the constraints, gcc reports the error.

Is it a bug of gcc-3.2.x and gcc-3.3? Or the above __asm__ usage is 
wrong in gcc-3.2.x and gcc-3.3? I think gcc-3.0.2 is right?

- Jie


             reply	other threads:[~2003-04-23  7:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-23 10:36 Jie Zhang [this message]
2003-04-23 22:27 ` tm_gccmail
2003-04-23 22:43 ` Richard Henderson
2003-04-24  5:42   ` Jie Zhang

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=3EA643B9.9090404@magima.com.cn \
    --to=zhangjie@magima.com.cn \
    --cc=gcc@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).