Re: Fix last unitialized memory warning - Mailing list pgsql-hackers

From Tristan Partin
Subject Re: Fix last unitialized memory warning
Date
Msg-id CTUJMJ1B57SL.3T8TKNTE9XSVD@gonk
Whole thread Raw
In response to Re: Fix last unitialized memory warning  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: Fix last unitialized memory warning
List pgsql-hackers
On Mon Jul 3, 2023 at 1:19 AM CDT, Peter Eisentraut wrote:
> On 07.06.23 16:31, Tristan Partin wrote:
> > This patch is really not necessary from a functional point of view. It
> > is only necessary if we want to silence a compiler warning.
> >
> > Tested on `gcc (GCC) 13.1.1 20230511 (Red Hat 13.1.1-2)`.
> >
> > After silencing this warning, all I am left with (given my build
> > configuration) is:
> >
> > [1667/2280] Compiling C object src/pl/plpgsql/src/plpgsql.so.p/pl_exec.c.o
> > In file included from ../src/include/access/htup_details.h:22,
> >                   from ../src/pl/plpgsql/src/pl_exec.c:21:
> > In function ‘assign_simple_var’,
> >      inlined from ‘exec_set_found’ at ../src/pl/plpgsql/src/pl_exec.c:8349:2:
> > ../src/include/varatt.h:230:36: warning: array subscript 0 is outside array bounds of ‘char[0]’ [-Warray-bounds=]
> >    230 |         (((varattrib_1b_e *) (PTR))->va_tag)
> >        |                                    ^
> > ../src/include/varatt.h:94:12: note: in definition of macro ‘VARTAG_IS_EXPANDED’
> >     94 |         (((tag) & ~1) == VARTAG_EXPANDED_RO)
> >        |            ^~~
> > ../src/include/varatt.h:284:57: note: in expansion of macro ‘VARTAG_1B_E’
> >    284 | #define VARTAG_EXTERNAL(PTR)                            VARTAG_1B_E(PTR)
> >        |                                                         ^~~~~~~~~~~
> > ../src/include/varatt.h:301:57: note: in expansion of macro ‘VARTAG_EXTERNAL’
> >    301 |         (VARATT_IS_EXTERNAL(PTR) && !VARTAG_IS_EXPANDED(VARTAG_EXTERNAL(PTR)))
> >        |                                                         ^~~~~~~~~~~~~~~
> > ../src/pl/plpgsql/src/pl_exec.c:8537:17: note: in expansion of macro ‘VARATT_IS_EXTERNAL_NON_EXPANDED’
> >   8537 |                 VARATT_IS_EXTERNAL_NON_EXPANDED(DatumGetPointer(newvalue)))
> >        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >  From my perspective, this warning definitely seems like a false
> > positive, but I don't know the code well-enough to say that for certain.
>
> I cannot reproduce this warning with gcc-13.  Are you using any
> non-standard optimization options.  Could you give your full configure
> and build commands and the OS?

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
$ ninja -C build

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



pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER
Next
From: Nathan Bossart
Date:
Subject: Re: Should we remove db_user_namespace?