[PATCH] Re: 1.7 winbase.h (ilockcmpexch) compile error

Dave Korn dave.korn.cygwin@googlemail.com
Tue Jul 7 21:09:00 GMT 2009


Brian Ford wrote:
> I'm trying to build Cygwin 1.7 from CVS to debug an ImageMagick problem on
> server 2008 that causes an access violation in cygwin1.dll.  Doe anyone
> know the work around for this issue?
> 
> g++ (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
> 
> winsup/cygwin/winbase.h: In
> member function `int pthread_mutex::_trylock(pthread*)':
> winsup/cygwin/winbase.h:59:
> warning: volatile register variables don't work as you might wish
> winsup/cygwin/winbase.h:63:
> error: can't find a register in class `AREG' while reloading `asm'

  The attached patch fixes the warning about volatile register variables, by
explicitly specifying the type, instead of using typeof() the input parameter
(which inherits the volatility), and which I also saw using gcc HEAD the other
day.

  It doesn't do anything about the reload failure, which is a bug in GCC-3,
since the usage is a standard usage supported by the documentation.  It's
possible that it may disappear as a side-effect, in which case all the better.
 (I experimented briefly with removing the register asm from the source and
building it with gcc-4.3.2, and the results were disappointing; we actually
got worse register allocation, resulting in some functions having larger stack
frames and more registers saved/restored, so I guess the RA can still benefit
from the extra hint.)

  Tested by building thread.o and shared.o with CFLAGS="-g -O2 --save-temps"
before and after and comparing the generated .s file; no differences except in
debug info, where (naturally) a bunch of bits changed in the flag words
encoding the datatypes of variables.

winsup/cygwin/ChangeLog:

	* winbase.h (ilockexch):  Avoid making 'ret' volatile.
	(ilockcmpexch):  Likewise.

  Ok?

    cheers,
      DaveK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winbase-no-volatile-temp.diff
Type: text/x-c
Size: 816 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20090707/93f13d2d/attachment.bin>


More information about the Cygwin-patches mailing list