This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with inline assembler in gcc-3.2


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]