Re: bitfield and gcc

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: bitfield and gcc
Дата
Msg-id CABRT9RAD-aOoJ4_ZaJdMs_EU34XcLb=4jQe3i5yESMCTK+JTQA@mail.gmail.com
обсуждение исходный текст
Ответ на bitfield and gcc  (Gaetano Mendola <mendola@gmail.com>)
Ответы Re: bitfield and gcc  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Sat, Feb 11, 2012 at 01:54, Gaetano Mendola <mendola@gmail.com> wrote:
> I wonder if somewhere in Postgres source "we" are relying on the GCC
> "correct behaviour" regarding the read-modify-write of bitfield in
> structures.

Probably not. I'm pretty sure that we don't have any bitfields, since
not all compilers are happy with them. And it looks like this behavior
doesn't affect other kinds of struct fields.

It sounds like the GCC guys are saying that it's theoretically
possible that the compiler will generate 64-bit read-modify-writes
regardless of the struct member types. In this light, PostgreSQL code
is not "correct" -- our slock_t uses a char type on i386/AMD64/SPARC
and 32-bit int on IA-64/PPC64. There are plenty of places where it's
adjacent to other small fields.

However, I don't think the latter is a problem with any compilers in
practice, as that would break a lot more code than just btrfs and
Postgres.

Regards,
Marti


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

Предыдущее
От: Chetan Suttraway
Дата:
Сообщение: Re: Optimize referential integrity checks (todo item)
Следующее
От: Kohei KaiGai
Дата:
Сообщение: Re: CUDA Sorting