Fix last remaining uninitialized memory warnings
authorPeter Eisentraut
Wed, 9 Aug 2023 08:00:50 +0000 (10:00 +0200)
committerPeter Eisentraut
Wed, 9 Aug 2023 08:00:50 +0000 (10:00 +0200)
gcc (version 13) fails to properly analyze the code due to the loop
stop condition including `l != NULL`. Let's just help it out.

Author: Tristan Partin 
Discussion: https://www.postgresql.org/message-id/flat/CT6HJ3U8068R.3A8SJMV02D9BC@gonk

src/bin/pgbench/pgbench.c
src/bin/pgbench/pgbench.h

index 539c2795e291ab0b73d37f2909923e469f082ce9..2ba3e367c482e92d67e924d5305486b097f1ab38 100644 (file)
@@ -2239,7 +2239,7 @@ evalStandardFunc(CState *st,
 {
    /* evaluate all function arguments */
    int         nargs = 0;
-   PgBenchValue vargs[MAX_FARGS];
+   PgBenchValue vargs[MAX_FARGS] = { 0 };
    PgBenchExprLink *l = args;
    bool        has_null = false;
 
index 957c9ca9dad9bc29ba2f061e3dd925c19271f067..f8efa4b868a7531ef4ef5faece048cca62d943fd 100644 (file)
@@ -33,7 +33,7 @@ union YYSTYPE;
  */
 typedef enum
 {
-   PGBT_NO_VALUE,
+   PGBT_NO_VALUE = 0,
    PGBT_NULL,
    PGBT_INT,
    PGBT_DOUBLE,