Skip to content

Commit

Permalink
Add missing volatile qualifier. (#17521)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
higuoxing authored May 23, 2024
1 parent b88beeb commit cfa141f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/backend/executor/nodeSubplan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,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;
Expand Down

0 comments on commit cfa141f

Please # to comment.