[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in throw.c

From: David Mosberger-Tang
Subject: Re: bug in throw.c
Date: Mon, 7 Apr 2003 23:44:32 -0700

>>>>> On Tue, 8 Apr 2003 01:31:06 -0500, Christopher Cramer <address@hidden> 
>>>>> said:

  Christopher> On Sun, Apr 06, 2003 at 05:01:36PM -0700, David
  Christopher> Mosberger-Tang wrote:
  >> #if 0/*def __GNUC__*/ /* Dirk:FIXME:: This bugfix should be
  >> removed some time. */ /* GCC 2.95.2 has a bug in its optimizer
  >> that makes it generate incorrect code sometimes.  This barrier
  >> stops it from being too clever. */ asm volatile ("" : "=g"
  >> (winds)); #endif

  >> This is clearly bogus: the asm statement claims that it's writing
  >> the "winds" variable, which isn't true.  On ia64, this has the
  >> effect that the "winds" gets corrupted and comes out with value
  >> "1".  Just

  Christopher> Now, I haven't checked up on the changes in recent GCC
  Christopher> versions, but that behavior seems really odd to me. How
  Christopher> does it change the value of a variable if you put in an
  Christopher> empty asm statement that only claims to change the
  Christopher> variable?

  Christopher> This is a common tactic to defeat the optimizer. I
  Christopher> don't understand why GCC would suddenly have problems
  Christopher> with this.

 asm volatile ("" : "=g"(winds))

tells the compiler that the old value of "winds" is dead.  It is
therefore free to use any register for holding the "new" value of
"winds" which is supposedly produced by the "asm volatile" statement.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]