pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Moore <paul.moore@centrify.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Subject: Re: BUG #13788: compile error in generic_msvc.h
Date: Wed, 2 Dec 2015 16:13:07 +0000
Message-ID: <BN4PR07MB2131DF8027DFBFD628475070F10E0@BN4PR07MB2131.namprd07.prod.outlook.com> (raw)
In-Reply-To: <5176.1449005701@sss.pgh.pa.us>
References: <20151201165457.2760.18019@wrigleys.postgresql.org>
	<5176.1449005701@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The 32 bit functions are defined on unsigned types

From winbase.h

FORCEINLINE
unsigned
InterlockedCompareExchange(
    _Inout_ _Interlocked_operand_ unsigned volatile *Destination,
    _In_ unsigned Exchange,
    _In_ unsigned Comperand
    )
{
    return (unsigned) _InterlockedCompareExchange((volatile long*) Destination, (long) Exchange, (long) Comperand);
}

The cast fixes the 64 bit case.

Full disclosure, I am compiling as c++. I think that might be the cause. I tried in a c project and did not get the same error

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Sent: Tuesday, December 1, 2015 1:35 PM
To: Paul Moore <paul.moore@centrify.com>
Cc: pgsql-bugs@postgresql.org; Andres Freund <andres@anarazel.de>
Subject: Re: [BUGS] BUG #13788: compile error in generic_msvc.h

paul.moore@centrify.com writes:
> Bug reference:      13788
> Logged by:          paul moore
> Email address:      paul.moore@centrify.com
> PostgreSQL version: 9.5beta1
> Operating system:   win server 2012
> Description:        

> vs 2015, compiling spi execq sample

> vc complains about this

> 1>c:\Program
> Files\PostgreSQL\9.5\include\server\port/atomics/generic-msvc.h(91): 
> error
> C2664: 'LONG64 _InterlockedCompareExchange64(volatile LONG64
> *,LONG64,LONG64)': cannot convert argument 1 from 'volatile uint64 *' 
> to 'volatile LONG64 *'

> same for the add64 function a few lines later

That's a bit weird.  A perhaps plausible explanation would be that the compiler is unhappy about passing an unsigned argument to a signed parameter; but if they've tightened it up like that, why no similar complaint for the 32-bit versions just above these?

Can you try inserting a cast to (volatile int64 *), just to see?

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (7+ messages)  latest in thread

Message-ID: <BN4PR07MB2131DF8027DFBFD628475070F10E0@BN4PR07MB2131.namprd07.prod.outlook.com>
Permalink:  ../BN4PR07MB2131DF8027DFBFD628475070F10E0@BN4PR07MB2131.namprd07.prod.outlook.com/
Also on:    postgresql.org/message-id/BN4PR07MB2131DF8027DFBFD628475070F10E0@BN4PR07MB2131.namprd07.prod.outlook.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: paul.moore@centrify.com, tgl@sss.pgh.pa.us, andres@anarazel.de
  Subject: Re: BUG #13788: compile error in generic_msvc.h
  In-Reply-To: <BN4PR07MB2131DF8027DFBFD628475070F10E0@BN4PR07MB2131.namprd07.prod.outlook.com>
  References: <20151201165457.2760.18019@wrigleys.postgresql.org> <5176.1449005701@sss.pgh.pa.us> <BN4PR07MB2131DF8027DFBFD628475070F10E0@BN4PR07MB2131.namprd07.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox