Re: BUG #5464: ecpg on 64bit system converts "long long" to "long"

Lists: pgsql-bugs
From: "Michael Enke" <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5464: ecpg on 64bit system converts "long long" to "long"
Date: 2010-05-19 08:53:12
Message-ID: 201005190853.o4J8rCJk054335@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5464
Logged by: Michael Enke
Email address: michael(dot)enke(at)wincor-nixdorf(dot)com
PostgreSQL version: 8.4.4
Operating system: Linux
Description: ecpg on 64bit system converts "long long" to "long"
Details:

This applies for at least ecpg 4.5.0 and 4.4.0.
On 32 bit system the type is not changed.
Example:
----------------------------------------
EXEC SQL INCLUDE sqlca;

EXEC SQL BEGIN DECLARE SECTION;
long long test;
EXEC SQL END DECLARE SECTION;

int main(int argc, char **argv) {

return 0;
}
----------------------------------------
If you run it through ecpg, in the resulting c file
the variable test has type long on 64 bit system.
On 32 bit system it is long long.


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5464: ecpg on 64bit system converts "long long" to "long"
Date: 2010-05-19 17:25:47
Message-ID: 20100519172547.GB12938@hyperion.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Wed, May 19, 2010 at 08:53:12AM +0000, Michael Enke wrote:
> If you run it through ecpg, in the resulting c file
> the variable test has type long on 64 bit system.
> On 32 bit system it is long long.

Apparently when this code was written "long long" was 64bit, but it doesn't
seem to be that way on 64bit systems nowadays. I will check to see if there is
an easy fix. If it is fairly interruptive the fix won't make it into 9.0
though.

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: John R Pierce <pierce(at)hogranch(dot)com>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5464: ecpg on 64bit system converts "long long" to "long"
Date: 2010-05-19 17:34:42
Message-ID: 4BF42132.6000803@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael Meskes wrote:
> On Wed, May 19, 2010 at 08:53:12AM +0000, Michael Enke wrote:
>
>> If you run it through ecpg, in the resulting c file
>> the variable test has type long on 64 bit system.
>> On 32 bit system it is long long.
>>
>
> Apparently when this code was written "long long" was 64bit, but it doesn't
> seem to be that way on 64bit systems nowadays. I will check to see if there is
> an easy fix. If it is fairly interruptive the fix won't make it into 9.0
> though.
>

I'm pretty sure it varies with the 64 bit system. I believe on IBM
Power, LONG LONG *is* 64 bit.


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5464: ecpg on 64bit system converts "long long" to "long"
Date: 2010-05-19 18:40:56
Message-ID: 20100519184056.GA27894@hyperion.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Wed, May 19, 2010 at 10:34:42AM -0700, John R Pierce wrote:
> I'm pretty sure it varies with the 64 bit system. I believe on IBM
> Power, LONG LONG *is* 64 bit.

I'm currently without real access to a 64bit system until I come back home. If
it is 64bit on *all* 64bit systems the problem is slightly different.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL


From: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5464: ecpg on 64bit system converts "long long" to "long"
Date: 2010-05-19 22:34:22
Message-ID: 4BF4676E.4080707@wincor-nixdorf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Michael Meskes schrieb:
> On Wed, May 19, 2010 at 10:34:42AM -0700, John R Pierce wrote:
>> I'm pretty sure it varies with the 64 bit system. I believe on IBM
>> Power, LONG LONG *is* 64 bit.
>
> I'm currently without real access to a 64bit system until I come back home. If
> it is 64bit on *all* 64bit systems the problem is slightly different.
>
> Michael

The size of long *and* long long is 64 bit on x86_64 system.
But the compiler throws warnings for %lld with long int type.
It should not be required to change the code to not run into such warnings.
Yes, I know the PRI... macros from inttypes.h ...

Michael

WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193

Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, John R Pierce <pierce(at)hogranch(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5464: ecpg on 64bit system converts "long long" to "long"
Date: 2010-05-20 22:11:40
Message-ID: 20100520221140.GA9902@hyperion.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

> > I'm currently without real access to a 64bit system until I come back home. If
> > it is 64bit on *all* 64bit systems the problem is slightly different.

Just committed a patch to HEAD that hopefully fixes the problem.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber meskes(at)jabber(dot)org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL