From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Recent failures on buildfarm member hornet |
Date: | 2020-10-07 22:36:36 |
Message-ID: | 20201007223636.GD1498955@rfd.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Oct 07, 2020 at 06:22:04PM -0400, Tom Lane wrote:
> Noah Misch <noah(at)leadboat(dot)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);
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2020-10-07 22:50:06 | Re: Add a log message on recovery startup before syncing datadir |
Previous Message | Tomas Vondra | 2020-10-07 22:34:38 | Re: enable_incremental_sort changes query behavior |