Re: currawong is not a happy animal

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: currawong is not a happy animal
Дата
Msg-id 20140117195437.GC4807@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: currawong is not a happy animal  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: currawong is not a happy animal  (Andrew Dunstan <andrew@dunslane.net>)
Re: currawong is not a happy animal  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane escribió:
> Andrew Dunstan <andrew@dunslane.net> writes:
> > Not quite out of the woods yet. We're getting this regression failure on 
> > Windows/MSVC (see 
> > <http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2014-01-17%2018%3A20%3A35>):
> 
> >    SELECT test_shm_mq(32768, (select string_agg(chr(32+(random()*96)::int), '') from generate_series(1,400)),
10000,1);
 
> > ! ERROR:  queue size must be at least 472262143 bytes
> 
> It looks like this is computing a bogus value:
> 
> const Size shm_mq_minimum_size =
>     MAXALIGN(offsetof(shm_mq, mq_ring)) + MAXIMUM_ALIGNOF;
> 
> I seem to recall that we've previously found that you have to write
> 
>     MAXALIGN(offsetof(shm_mq, mq_ring[0])) + MAXIMUM_ALIGNOF;
> 
> to keep MSVC happy with a reference to an array member in offsetof.

Hmm, this seems to contradict what's documented at the definition of
FLEXIBLE_ARRAY_MEMBER:

/* Define to nothing if C supports flexible array members, and to 1 if it does  not. That way, with a declaration like
`structs { int n; double  d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99  compilers. When
computingthe size of such an object, don't use 'sizeof  (struct s)' as it overestimates the size. Use 'offsetof (struct
s,d)'  instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with  MSVC and with C++ compilers. */
 
#define FLEXIBLE_ARRAY_MEMBER /**/


-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Turning off HOT/Cleanup sometimes
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: currawong is not a happy animal