Compiler warning on Debian 12, PostgreSQL 16 Beta3

Поиск
Список
Период
Сортировка
Искать

Compiler warning on Debian 12, PostgreSQL 16 Beta3

От:
"Daniel Westermann (DWE)" <daniel.westermann@dbi-services.com>
Дата:
Hi,

I've just noticed this warning when building on Debian 12:

In file included from /usr/lib/llvm-14/include/llvm/Analysis/ModuleSummaryAnalysis.h:17,
                 from llvmjit_inline.cpp:51:
/usr/lib/llvm-14/include/llvm/IR/ModuleSummaryIndex.h: In constructor ‘llvm::ModuleSummaryIndex::ModuleSummaryIndex(bool, bool)’:
/usr/lib/llvm-14/include/llvm/IR/ModuleSummaryIndex.h:1175:73: warning: member ‘llvm::ModuleSummaryIndex::Alloc’ is used uninitialized [-Wuninitialized]
 1175 |       : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc),
      |                    

cat /etc/debian_version 
12.1

Regards
Daniel

Re: Compiler warning on Debian 12, PostgreSQL 16 Beta3

От:
Alvaro Herrera <alvherre@alvh.no-ip.org>
Дата:
On 2023-Aug-25, Daniel Westermann (DWE) wrote:

> I've just noticed this warning when building on Debian 12:
> 
> In file included from /usr/lib/llvm-14/include/llvm/Analysis/ModuleSummaryAnalysis.h:17,
>                  from llvmjit_inline.cpp:51:
> /usr/lib/llvm-14/include/llvm/IR/ModuleSummaryIndex.h: In constructor ‘llvm::ModuleSummaryIndex::ModuleSummaryIndex(bool, bool)’:
> /usr/lib/llvm-14/include/llvm/IR/ModuleSummaryIndex.h:1175:73: warning: member ‘llvm::ModuleSummaryIndex::Alloc’ is used uninitialized [-Wuninitialized]
>  1175 |       : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc),
>       |                    

Yeah, I get this one too.  I thought commit 37d5babb5cfa ("jit: Support
opaque pointers in LLVM 16.") was going to silence it, but I was quite
mistaken.  I gave that code a quick look and could not understand what
it was complaining about.  Is it a bug in the LLVM headers?

Adding Andres and Thomas to CC, because they're the ones touching the
LLVM / JIT code.

Any clues?

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/


Re: Compiler warning on Debian 12, PostgreSQL 16 Beta3

От:
Thomas Munro <thomas.munro@gmail.com>
Дата:
On Wed, Nov 8, 2023 at 4:46 AM Alvaro Herrera  wrote:
> On 2023-Aug-25, Daniel Westermann (DWE) wrote:
> > I've just noticed this warning when building on Debian 12:
> >
> > In file included from /usr/lib/llvm-14/include/llvm/Analysis/ModuleSummaryAnalysis.h:17,
> >                  from llvmjit_inline.cpp:51:
> > /usr/lib/llvm-14/include/llvm/IR/ModuleSummaryIndex.h: In constructor ‘llvm::ModuleSummaryIndex::ModuleSummaryIndex(bool, bool)’:
> > /usr/lib/llvm-14/include/llvm/IR/ModuleSummaryIndex.h:1175:73: warning: member ‘llvm::ModuleSummaryIndex::Alloc’ is used uninitialized [-Wuninitialized]
> >  1175 |       : HaveGVs(HaveGVs), EnableSplitLTOUnit(EnableSplitLTOUnit), Saver(Alloc),
> >       |
>
> Yeah, I get this one too.  I thought commit 37d5babb5cfa ("jit: Support
> opaque pointers in LLVM 16.") was going to silence it, but I was quite
> mistaken.  I gave that code a quick look and could not understand what
> it was complaining about.  Is it a bug in the LLVM headers?

I found the commit where they fixed that in 15+:

https://github.com/llvm/llvm-project/commit/1d9086bf054c2e734940620d02d4451156b424e6

They don't seem to back-patch fixes, generally.


Re: Compiler warning on Debian 12, PostgreSQL 16 Beta3

От:
Alvaro Herrera <alvherre@alvh.no-ip.org>
Дата:
On 2023-Nov-08, Thomas Munro wrote:

> On Wed, Nov 8, 2023 at 4:46 AM Alvaro Herrera  wrote:
> > On 2023-Aug-25, Daniel Westermann (DWE) wrote:
> >
> > Yeah, I get this one too.  I thought commit 37d5babb5cfa ("jit: Support
> > opaque pointers in LLVM 16.") was going to silence it, but I was quite
> > mistaken.  I gave that code a quick look and could not understand what
> > it was complaining about.  Is it a bug in the LLVM headers?
> 
> I found the commit where they fixed that in 15+:
> 
> https://github.com/llvm/llvm-project/commit/1d9086bf054c2e734940620d02d4451156b424e6
> 
> They don't seem to back-patch fixes, generally.

Ah yeah, I can silence the warning by patching that file locally.

Annoying :-(

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"El sabio habla porque tiene algo que decir;
el tonto, porque tiene que decir algo" (Platon).


Re: Compiler warning on Debian 12, PostgreSQL 16 Beta3

От:
Thomas Munro <thomas.munro@gmail.com>
Дата:
On Wed, Nov 8, 2023 at 8:13 AM Alvaro Herrera  wrote:
> On 2023-Nov-08, Thomas Munro wrote:
> > On Wed, Nov 8, 2023 at 4:46 AM Alvaro Herrera  wrote:
> > > On 2023-Aug-25, Daniel Westermann (DWE) wrote:
> > >
> > > Yeah, I get this one too.  I thought commit 37d5babb5cfa ("jit: Support
> > > opaque pointers in LLVM 16.") was going to silence it, but I was quite
> > > mistaken.  I gave that code a quick look and could not understand what
> > > it was complaining about.  Is it a bug in the LLVM headers?
> >
> > I found the commit where they fixed that in 15+:
> >
> > https://github.com/llvm/llvm-project/commit/1d9086bf054c2e734940620d02d4451156b424e6
> >
> > They don't seem to back-patch fixes, generally.
>
> Ah yeah, I can silence the warning by patching that file locally.

Since LLVM only seems to maintain one branch at a time as a matter of
policy (I don't see were that is written down but I do see for example
their backport request format[1] which strictly goes from main to
(currently) release/17.x, and see how the commit history of each
release branch ends as a new branch is born), I suppose another angle
would be to check if the Debian maintainers carry extra patches for
stuff like that.  They're the ones creating the dependency on an 'old'
LLVM after all.  Unlike the RHEL/etc maintainers' fast rolling version
policy (that we learned about in the thread for CF #4640).  Who wants
to ship zombie unmaintained code for years?  On the other hand, Debian
itself rolls faster than RHEL.

[1] https://llvm.org/docs/GitHub.html


Re: Compiler warning on Debian 12, PostgreSQL 16 Beta3

От:
Thomas Munro <thomas.munro@gmail.com>
Дата:
On Wed, Nov 8, 2023 at 10:00 AM Thomas Munro  wrote:
> On Wed, Nov 8, 2023 at 8:13 AM Alvaro Herrera  wrote:
> > On 2023-Nov-08, Thomas Munro wrote:
> > > On Wed, Nov 8, 2023 at 4:46 AM Alvaro Herrera  wrote:
> > > > On 2023-Aug-25, Daniel Westermann (DWE) wrote:
> > > >
> > > > Yeah, I get this one too.  I thought commit 37d5babb5cfa ("jit: Support
> > > > opaque pointers in LLVM 16.") was going to silence it, but I was quite
> > > > mistaken.  I gave that code a quick look and could not understand what
> > > > it was complaining about.  Is it a bug in the LLVM headers?
> > >
> > > I found the commit where they fixed that in 15+:
> > >
> > > https://github.com/llvm/llvm-project/commit/1d9086bf054c2e734940620d02d4451156b424e6
> > >
> > > They don't seem to back-patch fixes, generally.
> >
> > Ah yeah, I can silence the warning by patching that file locally.

I was looking into buildfarm warnings today and noticed this one again
on 'hawk'.  My C++ is a little rusty but I wanted to know if anything
could actually break because of this, and I'm not seeing it.  I'm not
a lawyer but I'm not sure that "used" is even true in this statement:

"member ‘llvm::ModuleSummaryIndex::Alloc’ is used uninitialize"

... considering that StringSaver's constructor just binds a reference.
There can surely be no doubt about its address.  With that suspicion I
checked a few compilers and noticed that GCC 14 stopped emitting the
warning!  Then I found my way to:

https://github.com/gcc-mirror/gcc/commit/b83f3cd3ff765fb82344b848b8a128763b7a4233


FAQ