Re: Fix last unitialized memory warning

Поиск
Список
Период
Сортировка
От Tristan Partin
Тема Re: Fix last unitialized memory warning
Дата
Msg-id CU6BH3JA3GCY.25ETDNK3LVULF@gonk
обсуждение исходный текст
Ответ на Re: Fix last unitialized memory warning  (Peter Eisentraut <peter@eisentraut.org>)
Ответы Re: Fix last unitialized memory warning  (Peter Eisentraut <peter@eisentraut.org>)
Список pgsql-hackers
On Sun Jul 9, 2023 at 2:23 AM CDT, Peter Eisentraut wrote:
> On 06.07.23 15:41, Tristan Partin wrote:
> > On Thu Jul 6, 2023 at 3:21 AM CDT, Peter Eisentraut wrote:
> >> On 05.07.23 23:06, Tristan Partin wrote:
> >>> Thanks for following up. My system is Fedora 38. I can confirm this is
> >>> still happening on master.
> >>>
> >>> $ gcc --version
> >>> gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4)
> >>> Copyright (C) 2023 Free Software Foundation, Inc.
> >>> This is free software; see the source for copying conditions.  There is NO
> >>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> >>> $ meson setup build --buildtype=release
> >>
> >> This buildtype turns on -O3 warnings.  We have usually opted against
> >> chasing warnings in -O3 level because there are often some
> >> false-positive uninitialized variable warnings with every new compiler.
> >>
> >> Note that we have set the default build type to debugoptimized, for that
> >> reason.
> >
> > Good to know, thanks.
> >
> > Regarding the original patch, do you think it is good to be applied?
>
> That patch looks reasonable.  But I can't actually reproduce the
> warning, even with gcc-13.  I do get the warning from plpgsql.  Can you
> show the warning you are seeing?

Here is the full warning that the original patch suppresses.

[1360/1876] Compiling C object src/bin/pgbench/pgbench.p/pgbench.c.o
In function ‘coerceToInt’,
    inlined from ‘evalStandardFunc’ at ../src/bin/pgbench/pgbench.c:2607:11:
../src/bin/pgbench/pgbench.c:2032:17: warning: ‘vargs[0].type’ may be used uninitialized [-Wmaybe-uninitialized]
 2032 |         if (pval->type == PGBT_INT)
      |             ~~~~^~~~~~
../src/bin/pgbench/pgbench.c: In function ‘evalStandardFunc’:
../src/bin/pgbench/pgbench.c:2240:22: note: ‘vargs’ declared here
 2240 |         PgBenchValue vargs[MAX_FARGS];
      |                      ^~~~~
In function ‘coerceToInt’,
    inlined from ‘evalStandardFunc’ at ../src/bin/pgbench/pgbench.c:2607:11:
../src/bin/pgbench/pgbench.c:2034:32: warning: ‘vargs[0].u.ival’ may be used uninitialized [-Wmaybe-uninitialized]
 2034 |                 *ival = pval->u.ival;
      |                         ~~~~~~~^~~~~
../src/bin/pgbench/pgbench.c: In function ‘evalStandardFunc’:
../src/bin/pgbench/pgbench.c:2240:22: note: ‘vargs’ declared here
 2240 |         PgBenchValue vargs[MAX_FARGS];
      |                      ^~~~~
In function ‘coerceToInt’,
    inlined from ‘evalStandardFunc’ at ../src/bin/pgbench/pgbench.c:2607:11:
../src/bin/pgbench/pgbench.c:2039:40: warning: ‘vargs[0].u.dval’ may be used uninitialized [-Wmaybe-uninitialized]
 2039 |                 double          dval = rint(pval->u.dval);
      |                                        ^~~~~~~~~~~~~~~~~~
../src/bin/pgbench/pgbench.c: In function ‘evalStandardFunc’:
../src/bin/pgbench/pgbench.c:2240:22: note: ‘vargs’ declared here
 2240 |         PgBenchValue vargs[MAX_FARGS];
      |                      ^~~~~

--
Tristan Partin
Neon (https://neon.tech)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: psql: Add role's membership options to the \du+ command
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Use of additional index columns in rows filtering