Re: compiler warnings with gcc 4.8 and -Og

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: compiler warnings with gcc 4.8 and -Og
Date: 2022-06-02 15:01:49
Message-ID: 20220602150149.ey6l3czww5yvaptb@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-06-02 13:24:28 +0900, Michael Paquier wrote:
> On Wed, Jun 01, 2022 at 09:42:44PM -0500, Justin Pryzby wrote:
> > Today's "warnings" thread suggests to me that these are worth fixing - it seems
> > reasonable to compile postgres 14 on centos7 (as I sometimes have done), and
> > the patch seems even more reasonable when backpatched to older versions.
> > (Also, I wonder if there's any consideration to backpatch cirrus.yaml, which
> > uses -Og)
>
> https://en.wikipedia.org/wiki/CentOS#CentOS_releases tells that centos
> 7 will be supported until the end of 2024, so I would fix that.

To me fixing gcc 4.8 warnings feels like a fools errand, unless they're
verbose enough to make compilation exceedingly verbose (e.g. warnings in a
header).

> > The patch below applies and fixes warnings back to v13.
>
> I don't mind fixing what you have here, as a first step. All those
> cases are telling us that the compiler does not see PG_TRY() as
> something is can rely on to set up each variable. 7292fd8 is
> complaining about the same point, actually, aka setjmp clobberring the
> variable, isn't it? So wouldn't it be better to initialize them, as
> your patch does, but also mark them as volatile? In short, what
> happens with -Wclobber and a non-optimized compilation?

FWIW, I found -Wclobber to be so buggy as to be pointless.

I don't think it needs be volatile because it'll not be accessed if we error
out? At least in the first instances in Justin's patch.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-06-02 15:04:30 Re: compiler warnings with gcc 4.8 and -Og
Previous Message Greg Stark 2022-06-02 14:58:33 Re: PostgreSQL Limits: maximum number of columns in SELECT result