ancient sequence point bug

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема ancient sequence point bug
Дата
Msg-id 1366166131.8318.10.camel@vanquo.pezone.net
обсуждение исходный текст
Ответы Re: ancient sequence point bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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));       }
 

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

@@ -445,13 +455,13 @@ struct typmap       while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))       {
(*app)->am_oid= tup->t_data->t_oid;
 
-           memmove((char *) &(*app++)->am_typ,
-                   (char *) GETSTRUCT(tup),
-                   sizeof((*app)->am_typ));
+           memcpy((char *) &(*app)->am_typ,
+                  (char *) GETSTRUCT(tup),
+                  sizeof((*app)->am_typ));
+           app++;       }       heap_endscan(scan);       heap_close(rel, NoLock);

I think the same (move the app++, and change to memcpy (optionally))
should be done in the first case as well.




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

Предыдущее
От: Florian Pflug
Дата:
Сообщение: Re: Enabling Checksums
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ancient sequence point bug