Re: shm_toc_lookup API

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2017-06-05T19:06:06Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2017-06-05 14:57:10 -0400, Tom Lane wrote:
>> Meh.  Without volatile, I think that the compiler would be within its
>> rights to elide the nentry local variable and re-fetch toc->toc_nentry
>> each time through the loop.

> I don't think that's true.

Perhaps not, but I'm not quite convinced.  Anyway it doesn't matter,
at least not here.

			regards, tom lane


Commits

  1. Code review for shm_toc.h/.c.

  2. Don't be so trusting that shm_toc_lookup() will always succeed.