Re: Warning in the RecordTransactionAbort routine during compilationwith O3 flag

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Warning in the RecordTransactionAbort routine during compilationwith O3 flag
Дата
Msg-id 20191210031328.GG72921@paquier.xyz
обсуждение исходный текст
Ответ на Re: Warning in the RecordTransactionAbort routine during compilationwith O3 flag  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Ответы Re: Warning in the RecordTransactionAbort routine during compilationwith O3 flag  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Список pgsql-bugs
On Mon, Dec 09, 2019 at 02:03:43PM +0500, Andrey Lepikhov wrote:
> We already have assertion on the twophase_gid variable. But compiler is not
> so smart and can't find a link between the XACT_XINFO_HAS_GID flag and
> state of twophase_gid pointer.

Well, gcc-9 got visibly smarter on that point :)

> Ok. In accordance with your review, I have prepared a new version of the
> patch.

Regarding formatting.c, I can see the point of avoiding future
mistakes, and I would go a bit further as per the attached for
consistency between all variables.  have_error is a bit trickier
though as it gets moved around more layers so doing an initialization
in the middle is not really an option.  Anyway, we can do that rather
cleanly from the entry point of do_to_timestamp() to bring more
consistency for variables which are always expected and the optional
ones.  What do you think?

For the second one in xact.c, I am not really on board of doing
something based on the proposals because this reduces the code
visibility, and gcc is clearly wrong in its assumptions because the
state cannot be reached.

> My compiler:
>
> gcc -v
> [...]
> gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

Thanks, that's the difference.  gcc-9 does not complain, but I can see
the warnings with gcc-7 (7.5.0 actually).
--
xMichael

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Unexpected extra row from jsonb_path_query() with a recursivepath
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833numrange query