From: Noah Misch <noah@leadboat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Rowley <dgrowleyml@gmail.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Recent failures on buildfarm member hornet
Date: Wed, 7 Oct 2020 15:36:36 -0700
Message-ID: <20201007223636.GD1498955@rfd.leadboat.com> (raw)
In-Reply-To: <2399356.1602109324@sss.pgh.pa.us>
References: <20201007014507.GB1422897@rfd.leadboat.com>
<2040113.1602035809@sss.pgh.pa.us>
<20201007021941.GD1422897@rfd.leadboat.com>
<2233910.1602090798@sss.pgh.pa.us>
<CAApHDvovu2O+SLerPK2fCqKKP-q6NWinzACvJkMQ9zZNEiCKJg@mail.gmail.com>
<20201007212056.GB1498955@rfd.leadboat.com>
<2397925.1602107299@sss.pgh.pa.us>
<2398543.1602108196@sss.pgh.pa.us>
<20201007221221.GC1498955@rfd.leadboat.com>
<2399356.1602109324@sss.pgh.pa.us>
On Wed, Oct 07, 2020 at 06:22:04PM -0400, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > On Wed, Oct 07, 2020 at 06:03:16PM -0400, Tom Lane wrote:
> >> After thinking about it a bit more, I'm not even convinced that what
> >> xlc seems to be doing is illegal per C spec. There are no sequence
> >> points within
> >>
> >> return list_make2(list_concat(directargs, orderedargs),
> >> makeInteger(ndirectargs));
>
> > There is, however, a sequence point between list_length(directargs) and
> > list_concat(), and the problem arises because xlc reorders those two. It's
> > true that makeInteger() could run before or after list_concat(), but that
> > alone would not have been a problem.
>
> Yeah, that is the theory on which the existing code is built,
> specifically that the list_length fetch must occur before list_concat
> runs. What I am wondering about is a more aggressive interpretation of
> "sequence point", namely that the compiler is free to disregard exactly
> when list_concat's side-effects occur between this statement's sequence
> points. I'm not sure that the C spec allows that interpretation, but
> I'm not sure it doesn't, either.
C does not allow that, because the list_length() happens in a different "full
expression" (different statement):
ndirectargs = list_length(directargs);/* noah adds: a sequence point is here */
return list_make2(list_concat(directargs, orderedargs),
makeInteger(ndirectargs));
A compiler may implement like this:
ndirectargs = list_length(directargs);
a := list_concat(directargs, orderedargs);
b := makeInteger(ndirectargs);
return list_make2(a, b);
Or this:
ndirectargs = list_length(directargs);
b := makeInteger(ndirectargs);
a := list_concat(directargs, orderedargs);
return list_make2(a, b);
But not like this:
a := list_concat(directargs, orderedargs);
ndirectargs = list_length(directargs);
b := makeInteger(ndirectargs);
return list_make2(a, b);
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: noah@leadboat.com, tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Recent failures on buildfarm member hornet
In-Reply-To: <20201007223636.GD1498955@rfd.leadboat.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