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: Jaimon Jose <jjaimon at yahoo dot com>
- To: Richard dot Earnshaw at arm dot com
- Cc: Richard Henderson <rth at redhat dot com>, gcc-bugs at gcc dot gnu dot org
- Date: 04 Nov 2002 16:57:05 +0530
- Subject: Re: Problems with inline assembler in gcc-3.2
- References: <200210311128.g9VBS2311339@pc960.cambridge.arm.com>
Thanks, that works. But won't this change affect the backward
compatibility of compiler. I have filed a bug against this. (c/8375).
Should I keep this or close?
--jaimon
On Thu, 2002-10-31 at 16:58, Richard Earnshaw wrote:
> > 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?