pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marko Tiikkaja <pgmail@joh.to>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7516: PL/Perl crash
Date: Thu, 13 Sep 2012 16:37:41 -0400
Message-ID: <21173.1347568661@sss.pgh.pa.us> (raw)
In-Reply-To: <505229E8.9070507@joh.to>
References: <E1T8YUZ-0006gb-Oz@wrigleys.postgresql.org>
	<1194.1346688396@sss.pgh.pa.us>
	<5047BA9C.2040405@joh.to>
	<16153.1347226320@sss.pgh.pa.us>
	<17785.1347230278@sss.pgh.pa.us>
	<504F8034.20802@joh.to>
	<4011.1347407415@sss.pgh.pa.us>
	<50506B94.5040003@joh.to>
	<17684.1347558484@sss.pgh.pa.us>
	<505229E8.9070507@joh.to>

Marko Tiikkaja <pgmail@joh.to> writes:
> On 13/09/2012 19:48, Tom Lane wrote:
>> Hm, I wonder if it's Ubuntu-specific?  What Perl version is that exactly?

> We've reproduced it on both 5.14.2 and 5.16.1.

Meh.  I've managed to reproduce it on the fifth system I tried.  I don't
think it's got anything to do with the Perl version, but with the gcc
version (which is 4.7.0 on this machine).  Apparently, very recent gcc
versions are willing to throw away this line of code:

        PG_CATCH();
        {
----->          current_call_data = save_call_data;
                activate_interpreter(oldinterp);
                PG_RE_THROW();
        }
        PG_END_TRY();

        current_call_data = save_call_data;
        activate_interpreter(oldinterp);
	return retval;

Apparently the reasoning is that current_call_data is a static and
therefore the compiler can see everything that can happen to it and
therefore this store into current_call_data is dead code, since the
store six lines below will replace it.  Sigh.  I shall file a bug,
but I've found that the current crop of gcc maintainers are quite
likely to reject such reports.

We could fix the immediate problem by marking current_call_data volatile
(I've tested that this makes the problem go away on F17), but I think
what we'd better do instead is mark pg_re_throw() as noreturn.
Hopefully that will also prevent this misoptimization, as well as
similar ones that might be happening elsewhere.

			regards, tom lane




view thread (18+ messages)  latest in thread

Message-ID: <21173.1347568661@sss.pgh.pa.us>
Permalink:  ../21173.1347568661@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21173.1347568661@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, pgmail@joh.to
  Subject: Re: BUG #7516: PL/Perl crash
  In-Reply-To: <21173.1347568661@sss.pgh.pa.us>
  References: <E1T8YUZ-0006gb-Oz@wrigleys.postgresql.org> <1194.1346688396@sss.pgh.pa.us> <5047BA9C.2040405@joh.to> <16153.1347226320@sss.pgh.pa.us> <17785.1347230278@sss.pgh.pa.us> <504F8034.20802@joh.to> <4011.1347407415@sss.pgh.pa.us> <50506B94.5040003@joh.to> <17684.1347558484@sss.pgh.pa.us> <505229E8.9070507@joh.to> <21173.1347568661@sss.pgh.pa.us>

* 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