This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Problems with inline assembler in gcc-3.2
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Jaimon Jose <jjaimon at yahoo dot com>, gcc-bugs at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Thu, 31 Oct 2002 11:28:01 +0000
- Subject: Re: Problems with inline assembler in gcc-3.2
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> On Fri, Oct 25, 2002 at 02:40:54PM +0530, Jaimon Jose wrote:
> > static inline int atomic_inc(volatile int *p)
> > {
> > __asm__ __volatile__(
> > "lock; incl %0"
> > :"=m" (*p)
> > :"0" (*p));
>
> You're in dicey territory here. The compiler believes that
> you have two references to a volatile memory, and so it can't
> put them at the same location. This is clearly not what you
> intended.
>
> File a bug. This should be handled more gracefully.
>
Does using
__asm__ __volatile__(
"lock; incl %0"
:"+m" (*p));
work?