From: | Maxim Orlov <orlovmg(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | m(dot)litsarev(at)postgrespro(dot)ru, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Warning -Wclobbered in PG_TRY(...) |
Date: | 2025-05-30 08:12:15 |
Message-ID: | CACG=ezahAraOdD2TE8aX8ABvONip09TvP8UPrQF4WFJ5FB79ZA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 29 May 2025 at 18:26, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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);
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.
[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21161
--
Best regards,
Maxim Orlov.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2025-05-30 08:49:50 | Re: Replication slot is not able to sync up |
Previous Message | jian he | 2025-05-30 08:06:53 | Re: Foreign key validation failure in 18beta1 |