From c0ef456b9714215cae0ce3561c7c83629a7301cf Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon, 23 Jan 2017 09:15:49 -0500
Subject: [PATCH] Volatile-ize some plperl variables that must survive into
 PG_CATCH blocks.

This appears to be necessary to fix a failure seen on buildfarm member
sittella.  It shouldn't be necessary according to the letter of the C
standard, because we don't change the values of these variables within
the PG_TRY blocks; but somehow gcc 4.7.2 is dropping the ball.

Discussion: https://postgr.es/m/17555.1485179975@sss.pgh.pa.us
---
 src/pl/plperl/plperl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 9a2d0527f81..fc10d30f45b 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1763,8 +1763,8 @@ Datum
 plperl_call_handler(PG_FUNCTION_ARGS)
 {
 	Datum		retval;
-	plperl_call_data *save_call_data = current_call_data;
-	plperl_interp_desc *oldinterp = plperl_active_interp;
+	plperl_call_data *volatile save_call_data = current_call_data;
+	plperl_interp_desc *volatile oldinterp = plperl_active_interp;
 	plperl_call_data this_call_data;
 
 	/* Initialize current-call status record */
@@ -1813,8 +1813,8 @@ plperl_inline_handler(PG_FUNCTION_ARGS)
 	FunctionCallInfoData fake_fcinfo;
 	FmgrInfo	flinfo;
 	plperl_proc_desc desc;
-	plperl_call_data *save_call_data = current_call_data;
-	plperl_interp_desc *oldinterp = plperl_active_interp;
+	plperl_call_data *volatile save_call_data = current_call_data;
+	plperl_interp_desc *volatile oldinterp = plperl_active_interp;
 	plperl_call_data this_call_data;
 	ErrorContextCallback pl_error_context;
 
-- 
GitLab