This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [PATCH] Re: 1.7 winbase.h (ilockcmpexch) compile error
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Tue, 7 Jul 2009 17:32:02 -0400
- Subject: Re: [PATCH] Re: 1.7 winbase.h (ilockcmpexch) compile error
- References: <Pine.CYG.4.58.0906241239470.2248@PC1163-8460-XP.flightsafety.com> <4A53BC5D.7010401@gmail.com>
- Reply-to: cygwin-patches at cygwin dot com
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
>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?
Yes. Thanks.
cgf