Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Silence compiler warnings from some older compilers.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Jun 2022 21:21:45 +0000 (17:21 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 1 Jun 2022 21:21:45 +0000 (17:21 -0400)
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
src/backend/access/brin/brin.c

index cb6475d41f0ed631023f3f174744ad6a32409074..1a0606704ab3e39a3bde9a1d7ae1cd5f758af744 100644 (file)
@@ -263,7 +263,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;
index 781cac25d825bc7d9572a4fc2650b8f4587149d0..d9573bece706fe89956aeb6f078f86ac0e18ba5b 100644 (file)
@@ -919,7 +919,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);