Re: [INTERFACES] libecpg (8.0 and CVS) hits a gcc bug on powerpc

Lists: pgsql-bugspgsql-interfacespgsql-patches
From: Christof Petig <christof(at)petig-baender(dot)de>
To: pgsql-patches(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Cc: Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: libecpg (8.0 and CVS) hits a gcc bug on powerpc and amd64 (crash)
Date: 2005-03-16 14:12:56
Message-ID: 42383EE8.5070503@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-interfaces pgsql-patches

NB: The crossposting is actually suggested on the mailing list description:
"If you've found a bug in PostgreSQL, please send it both to this list
and also to the pgsql-patches list."

Amd64 and powerpc share an ABI design which enables variable passing in
registers and which makes va_list a complex datatype. Due to gcc not
implementing a part of the C9x standard
(http://mail-index.netbsd.org/tech-toolchain/2003/11/11/0011.html)
taking a pointer to a va_list will fail on these platforms. The
corresponding bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8262) is
closed, so the gcc developers seem not to plan to change this.

So I propose the following hack (feel free to improve it!) to go into
mainline. Since only powerpc and amd64 are affected (and the old method
does not work at all here at all) the patch should not be controversial.

Christof

PS: I don't know about other architectures. I can't believe that only
ppc and amd64 pass parameters in registers.
PPS: I could not test it on amd64, but all docs indicate the same behaviour.

Attachment Content-Type Size
ecpg_ppc.patch.gz application/x-gzip 1.1 KB

From: Christof Petig <christof(at)petig-baender(dot)de>
To:
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org, Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [INTERFACES] libecpg (8.0 and CVS) hits a gcc bug on powerpc
Date: 2005-03-16 15:30:00
Message-ID: 423850F8.3030008@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-interfaces pgsql-patches

Christof Petig schrieb:
> So I propose the following hack (feel free to improve it!) to go into
> mainline. Since only powerpc and amd64 are affected (and the old method
> does not work at all here at all) the patch should not be controversial.

I failed to mention that call by reference is the default for va_list on
these platforms (that's actually the cause of the bug).

Christof


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Christof Petig <christof(at)petig-baender(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org, Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [INTERFACES] libecpg (8.0 and CVS) hits a gcc bug on powerpc and amd64 (crash)
Date: 2005-03-18 10:01:51
Message-ID: 20050318100151.GA11769@1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-interfaces pgsql-patches

Patch committed. Thanks.

Michael

--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


From: Christof Petig <christof(at)petig-baender(dot)de>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org, Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libecpg (8.0 and CVS) hits a gcc bug on powerpc
Date: 2005-06-16 14:45:58
Message-ID: 42B190A6.7010409@petig-baender.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-interfaces pgsql-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Meskes schrieb:
> Patch committed. Thanks.

I have to admit that I got the case of the preprocessor symbol on amd64
wrong. __AMD64__ is not defined, __amd64__ is.

Sorry, corrected patch attached
Christof
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCsZCmng+R+0ucfO0RAoABAKDKnokBW+tgXMKgeEMecpZsFXRFTQCeKeBu
YsdWP056cqxKtNAx5Gh/Wis=
=b2Og
-----END PGP SIGNATURE-----

Attachment Content-Type Size
ecpglib.patch text/x-patch 2.0 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christof Petig <christof(at)petig-baender(dot)de>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org, Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libecpg (8.0 and CVS) hits a gcc bug on powerpc
Date: 2005-06-28 00:47:24
Message-ID: 200506280047.j5S0lOT09470@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-interfaces pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Christof Petig wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Michael Meskes schrieb:
> > Patch committed. Thanks.
>
> I have to admit that I got the case of the preprocessor symbol on amd64
> wrong. __AMD64__ is not defined, __amd64__ is.
>
> Sorry, corrected patch attached
> Christof
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFCsZCmng+R+0ucfO0RAoABAKDKnokBW+tgXMKgeEMecpZsFXRFTQCeKeBu
> YsdWP056cqxKtNAx5Gh/Wis=
> =b2Og
> -----END PGP SIGNATURE-----

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christof Petig <christof(at)petig-baender(dot)de>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-patches(at)postgresql(dot)org, Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: libecpg (8.0 and CVS) hits a gcc bug on powerpc
Date: 2005-07-04 19:05:57
Message-ID: 200507041905.j64J5v012606@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-interfaces pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Christof Petig wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Michael Meskes schrieb:
> > Patch committed. Thanks.
>
> I have to admit that I got the case of the preprocessor symbol on amd64
> wrong. __AMD64__ is not defined, __amd64__ is.
>
> Sorry, corrected patch attached
> Christof
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFCsZCmng+R+0ucfO0RAoABAKDKnokBW+tgXMKgeEMecpZsFXRFTQCeKeBu
> YsdWP056cqxKtNAx5Gh/Wis=
> =b2Og
> -----END PGP SIGNATURE-----

[ text/x-patch is unsupported, treating like TEXT/PLAIN ]

> Index: src/interfaces/ecpg/ecpglib/execute.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v
> retrieving revision 1.40
> diff -u -u -r1.40 execute.c
> --- src/interfaces/ecpg/ecpglib/execute.c 2 Jun 2005 12:35:11 -0000 1.40
> +++ src/interfaces/ecpg/ecpglib/execute.c 16 Jun 2005 14:35:09 -0000
> @@ -70,7 +70,7 @@
> return res;
> }
>
> -#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__) || defined(__x86_64__))
> +#if defined(__GNUC__) && (defined (__powerpc__) || defined(__amd64__) || defined(__x86_64__))
> #define APREF ap
> #else
> #define APREF *ap
> @@ -178,7 +178,7 @@
> if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno)))
> return false;
>
> -#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__) || defined(__x86_64__))
> +#if defined(__GNUC__) && (defined (__powerpc__) || defined(__amd64__) || defined(__x86_64__))
> ECPGget_variable(ap, type, var, true);
> #else
> ECPGget_variable(&ap, type, var, true);
> Index: src/interfaces/ecpg/ecpglib/extern.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/ecpglib/extern.h,v
> retrieving revision 1.13
> diff -u -u -r1.13 extern.h
> --- src/interfaces/ecpg/ecpglib/extern.h 2 Jun 2005 12:35:11 -0000 1.13
> +++ src/interfaces/ecpg/ecpglib/extern.h 16 Jun 2005 14:35:09 -0000
> @@ -125,7 +125,7 @@
> bool ECPGstore_result(const PGresult *results, int act_field,
> const struct statement * stmt, struct variable * var);
> bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool *);
> -#if defined(__GNUC__) && (defined (__powerpc__) || defined(__AMD64__) || defined(__x86_64__))
> +#if defined(__GNUC__) && (defined (__powerpc__) || defined(__amd64__) || defined(__x86_64__))
> // work around a gcc/ABI bug with va_lists on ppc+amd64
> void ECPGget_variable(va_list, enum ECPGttype, struct variable *, bool);
> #else

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073