Re: ancient sequence point bug

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ancient sequence point bug
Дата
Msg-id 16321.1366167099@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ancient sequence point bug  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: ancient sequence point bug  (Dann Corbit <DCorbit@connx.com>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> This code in bootstrap.c contains a sequence point violation (or
> whatever that is really called):

>         while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
>         {
>             (*app)->am_oid = HeapTupleGetOid(tup);
>             memmove((char *) &(*app++)->am_typ,
>                     (char *) GETSTRUCT(tup),
>                     sizeof((*app)->am_typ));
>         }

What exactly is the violation?  sizeof() is a side-effect-free compile
time constant, and the first value to be passed to memmove seems
perfectly well defined.

I grant that this is not terribly good coding style, but I don't believe
there's an actual risk here.

> In commit 1aebc361, another place in the same file was fixed like this:

Well, I don't really remember why I did that twelve years ago, but
seeing that there are a number of purely-cosmetic changes in that
commit, I'm thinking it was only meant to be cosmetic.

I certainly have no objection to making this code look more like that
code, I'm just not seeing that it's a bug.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: ancient sequence point bug
Следующее
От: Dann Corbit
Дата:
Сообщение: Re: ancient sequence point bug