• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: impossible constraint in asm
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: impossible constraint in asm


  • Subject: Re: impossible constraint in asm
  • From: Terry Lambert <email@hidden>
  • Date: Tue, 07 Oct 2008 01:41:54 -0700

On Oct 6, 2008, at 6:36 PM, Steve Jenson <email@hidden> wrote:
I've inherited a chunk of code and am trying to get it to compile on
Leopard but am running into a problem and I'm hoping somebody on this
list has seen it before.

typedef uint32_t lockStructure;
static inline int __compareAndSwap(lockStructure *ptr, lockStructure
old, lockStructure new) {
 lockStructure prev = old;
 asm volatile("lock cmpxchgl %1,%2" : "=a" (old) : "q" (new), "m"
(*ptr),"0" (old) : "memory");
 return old != prev;
}

When I try to compile this, I get the following error for the line
starting with asm:

error: impossible constraint in 'asm'

This isn't with Xcode but instead with a standard Makefile. I'm using
the stock gcc 4.0.1 that comes with the latest Xcode.

You can't use the lock prefix with a locked instruction. It's illegal. Google "F00F bug" for more information.


-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >impossible constraint in asm (From: "Steve Jenson" <email@hidden>)

  • Prev by Date: Re: impossible constraint in asm
  • Next by Date: daemon-child dies on user lougout
  • Previous by thread: Re: impossible constraint in asm
  • Next by thread: Is it guaranteed safe to pass NULL to free()?
  • Index(es):
    • Date
    • Thread