This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 0e5ea80b79550264c317c82cde7f112eb583d6a0
Author: Xing Guo <[email protected]>
AuthorDate: Thu May 23 14:38:02 2024 +0800

    Add missing volatile qualifier. (#17521)
    
    According to C99 7.13.2.1[^1],
    
    > All accessible objects have values, and all other components of the
    abstract machine have state, as of the time the longjmp function was
    called, except that the values of objects of automatic storage duration
    that are local to the function containing the invocation of the
    corresponding setjmp macro that do not have volatile-qualified type and
    have been changed between the setjmp invocation and longjmp call are
    indeterminate.
    
    The object oldcontext is changed in line 1194 (inside PG_TRY() block)
    and read in line 1434 (inside PG_CATCH() block).  We should qualify it
    with volatile.
    
    [^1]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
---
 src/backend/executor/nodeSubplan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/executor/nodeSubplan.c 
b/src/backend/executor/nodeSubplan.c
index 5d63b939c7..79ae556a59 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -1104,7 +1104,7 @@ ExecSetParamPlan(SubPlanState *node, ExprContext 
*econtext, QueryDesc *queryDesc
        SubLinkType subLinkType = subplan->subLinkType;
        EState     *estate = planstate->state;
        ScanDirection dir = estate->es_direction;
-       MemoryContext oldcontext = NULL;
+       volatile MemoryContext oldcontext = NULL;
        TupleTableSlot *slot;
        ListCell   *pvar;
        ListCell   *l;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to