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

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Tue Jul 7 21:32:00 GMT 2009

On Tue, Jul 07, 2009 at 10:21:33PM +0100, Dave Korn wrote:
>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
>  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.
>	* winbase.h (ilockexch):  Avoid making 'ret' volatile.
>	(ilockcmpexch):  Likewise.
>  Ok?

Yes.  Thanks.


More information about the Cygwin-patches mailing list