Fix erroneous -Werror=missing-braces on old GCC
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 10 Aug 2023 14:55:07 +0000 (16:55 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 10 Aug 2023 14:55:07 +0000 (16:55 +0200)
The buildfarm reports that this is an error on gcc (Debian 4.7.2-5)
4.7.2, 32-bit. The bug seems to be GCC bug 53119, which has obviously
been fixed for years.

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

src/bin/pgbench/pgbench.c

index 2ba3e367c482e92d67e924d5305486b097f1ab38..d2b7fc87e44b76e84f39919a9c2a8a1e6895fb3d 100644 (file)
@@ -2239,10 +2239,15 @@ evalStandardFunc(CState *st,
 {
        /* evaluate all function arguments */
        int                     nargs = 0;
-       PgBenchValue vargs[MAX_FARGS] = { 0 };
        PgBenchExprLink *l = args;
        bool            has_null = false;
 
+       /*
+        * This value is double braced to workaround GCC bug 53119, which seems to
+        * exist at least on gcc (Debian 4.7.2-5) 4.7.2, 32-bit.
+        */
+       PgBenchValue vargs[MAX_FARGS] = { { 0 } };
+
        for (nargs = 0; nargs < MAX_FARGS && l != NULL; nargs++, l = l->next)
        {
                if (!evaluateExpr(st, l->expr, &vargs[nargs]))