From cc0dae3abd10bc73c2a1fbf3dc86e1e4dd8be922 Mon Sep 17 00:00:00 2001
From: Maxim Orlov <orlovmg@gmail.com>
Date: Thu, 29 May 2025 17:19:09 +0300
Subject: [PATCH v1] Use volatile to avoid unspecified behavior in PG_TRY

---
 src/include/utils/elog.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 5eac0e16970..5d0e3fd4aa4 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -387,7 +387,7 @@ extern PGDLLIMPORT ErrorContextCallback *error_context_stack;
 		sigjmp_buf *_save_exception_stack##__VA_ARGS__ = PG_exception_stack; \
 		ErrorContextCallback *_save_context_stack##__VA_ARGS__ = error_context_stack; \
 		sigjmp_buf _local_sigjmp_buf##__VA_ARGS__; \
-		bool _do_rethrow##__VA_ARGS__ = false; \
+		volatile bool _do_rethrow##__VA_ARGS__ = false; \
 		if (sigsetjmp(_local_sigjmp_buf##__VA_ARGS__, 0) == 0) \
 		{ \
 			PG_exception_stack = &_local_sigjmp_buf##__VA_ARGS__
-- 
2.49.0

