Compiling warnings on old GCC

Started by Richard Guoalmost 3 years ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t48703
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 11:53 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t48703_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t48703_1 && git checkout t48703_1

Patchset v1 (message #1) is on t48703_1

Jump to latest
#1Richard Guo
guofenglinux@gmail.com

I came across the following compiling warnings on GCC (Red Hat 4.8.5-44)
4.8.5 with 'CFLAGS=-Og'

be-fsstubs.c: In function ‘be_lo_export’:
be-fsstubs.c:537:24: warning: ‘fd’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
if (CloseTransientFile(fd) != 0)
^
In file included from trigger.c:14:0:
trigger.c: In function ‘ExecCallTriggerFunc’:
../../../src/include/postgres.h:314:2: warning: ‘result’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
return (Pointer) X;
^
trigger.c:2316:9: note: ‘result’ was declared here
Datum result;
^

I wonder if this is worth fixing, maybe by a trivial patch like
attached.

Thanks
Richard

Attachments:

t48703_1
v1-0001-Silence-old-compiler-about-Wmaybe-uninitialized.patchapplication/octet-stream; name=v1-0001-Silence-old-compiler-about-Wmaybe-uninitialized.patchDownload+2-3
#2David Rowley
dgrowleyml@gmail.com
In reply to: Richard Guo (#1)
Re: Compiling warnings on old GCC

On Mon, 6 Nov 2023 at 19:14, Richard Guo <guofenglinux@gmail.com> wrote:

I came across the following compiling warnings on GCC (Red Hat 4.8.5-44)
4.8.5 with 'CFLAGS=-Og'

I wonder if this is worth fixing, maybe by a trivial patch like
attached.

There's some relevant discussion in
/messages/by-id/flat/20220602024243.GJ29853@telsasoft.com

David

#3Richard Guo
guofenglinux@gmail.com
In reply to: David Rowley (#2)
Re: Compiling warnings on old GCC

On Mon, Nov 6, 2023 at 2:51 PM David Rowley <dgrowleyml@gmail.com> wrote:

On Mon, 6 Nov 2023 at 19:14, Richard Guo <guofenglinux@gmail.com> wrote:

I came across the following compiling warnings on GCC (Red Hat 4.8.5-44)
4.8.5 with 'CFLAGS=-Og'

I wonder if this is worth fixing, maybe by a trivial patch like
attached.

There's some relevant discussion in
/messages/by-id/flat/20220602024243.GJ29853@telsasoft.com

Ah, thanks for pointing that out. Somehow I failed to follow that
thread.

It seems that the controversial '-Og' coupled with the old GCC version
(4.8) makes it not worth fixing. So please ignore this thread.

Thanks
Richard

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Richard Guo (#3)
Re: Compiling warnings on old GCC

Richard Guo <guofenglinux@gmail.com> writes:

On Mon, Nov 6, 2023 at 2:51 PM David Rowley <dgrowleyml@gmail.com> wrote:

There's some relevant discussion in
/messages/by-id/flat/20220602024243.GJ29853@telsasoft.com

It seems that the controversial '-Og' coupled with the old GCC version
(4.8) makes it not worth fixing. So please ignore this thread.

Although nobody tried to enunciate a formal policy in the other thread,
I think where we ended up is that we'd consider suppressing warnings
seen with -Og, but only with reasonably-modern compiler versions.
For LTS compilers we are only going to care about warnings seen with
production flags (i.e., -O2 or better).

regards, tom lane