postgres.git / summary / log / commit / refs

commit    4e467261560f087e0c75452646695a4edbb09de7
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Wed Jun 01 21:21:45 2022 +0000
First released in: 15.0, 10.22, 11.17, 12.12, 13.8, 14.4

    Silence compiler warnings from some older compilers.
    
    Since a117cebd6, some older gcc versions issue "variable may be used
    uninitialized in this function" complaints for brin_summarize_range.
    Silence that using the same coding pattern as in bt_index_check_internal;
    arguably, a117cebd6 had too narrow a view of which compilers might give
    trouble.
    
    Nathan Bossart and Tom Lane.  Back-patch as the previous commit was.
    
    Discussion: https://postgr.es/m/20220601163537.GA2331988@nathanxps13


contrib/amcheck/verify_nbtree.c | 2 +- src/backend/access/brin/brin.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c index f23bc1473b0..7f8231a6815 100644 --- a/contrib/amcheck/verify_nbtree.c +++ b/contrib/amcheck/verify_nbtree.c @@ -283,7 +283,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed, else { heaprel = NULL; - /* for "gcc -Og" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394 */ + /* Set these just to suppress "uninitialized variable" warnings */ save_userid = InvalidOid; save_sec_context = -1; save_nestlevel = -1; diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index 685899fc24c..21a23842595 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -1053,7 +1053,13 @@ brin_summarize_range(PG_FUNCTION_ARGS) save_nestlevel = NewGUCNestLevel(); } else + { heapRel = NULL; + /* Set these just to suppress "uninitialized variable" warnings */ + save_userid = InvalidOid; + save_sec_context = -1; + save_nestlevel = -1; + } indexRel = index_open(indexoid, ShareUpdateExclusiveLock); [parent: 1072e4c45dc3]