Re: Warning -Wclobbered in PG_TRY(...)
От | Maxim Orlov |
---|---|
Тема | Re: Warning -Wclobbered in PG_TRY(...) |
Дата | |
Msg-id | CACG=ezahAraOdD2TE8aX8ABvONip09TvP8UPrQF4WFJ5FB79ZA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Warning -Wclobbered in PG_TRY(...) (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On Thu, 29 May 2025 at 18:26, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Go there and use the "keyword search" for "longjmp" --- they
don't seem to make it possible to bookmark individual pages.
Indeed, you are fully correct. I didn't analyse the code well enough. The equivalent code
for PG_TRY/PG_FINALLY/PG_END_TRY will appear like the following:
do {
jmp_buf *_save_exception_stack = PG_exception_stack;
jmp_buf _local_sigjmp_buf;
bool _do_rethrow = false;
if (setjmp(_local_sigjmp_buf) == 0)
{
PG_exception_stack = &_local_sigjmp_buf;
/* try here */
longjmp(_local_sigjmp_buf, 1); /* elog ERROR */
}
else
_do_rethrow = true;
{
PG_exception_stack = _save_exception_stack;
/* catch */
}
if (_do_rethrow)
pg_re_throw();
PG_exception_stack = _save_exception_stack;
/* finally */
} while (0);
jmp_buf *_save_exception_stack = PG_exception_stack;
jmp_buf _local_sigjmp_buf;
bool _do_rethrow = false;
if (setjmp(_local_sigjmp_buf) == 0)
{
PG_exception_stack = &_local_sigjmp_buf;
/* try here */
longjmp(_local_sigjmp_buf, 1); /* elog ERROR */
}
else
_do_rethrow = true;
{
PG_exception_stack = _save_exception_stack;
/* catch */
}
if (_do_rethrow)
pg_re_throw();
PG_exception_stack = _save_exception_stack;
/* finally */
} while (0);
There is no problem here. We only change _do_rethrow after longjmp. Apparently, we're
dealing with a false positive warning here. Not sure, but it could be something like [0]. The
correct solution in this case would be to disable clobbered warning.
--
Best regards,
Maxim Orlov.
В списке pgsql-hackers по дате отправления: