Re: Debian 12 gcc warning

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Debian 12 gcc warning
Date: 2023-09-06 16:33:31
Message-ID: ZPip2/KeP7y7RlTJ@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 30, 2023 at 11:34:22AM -0400, Bruce Momjian wrote:
> Good news, I was able to prevent the bug by causing compiling of
> clauses.c to use -O2 by adding this to src/Makefile.custom:
>
> clauses.o : CFLAGS+=-O2
>
> Here is my submitted bug report:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111240

I got this reply on the bug report:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111240#c5

Richard Biener 2023-08-31 09:46:44 UTC

Confirmed.

rettype_58 = enforce_generic_type_consistency (&actual_arg_types, &declared_arg_types, 0, _56, 0);

and we reach this on the args == 0 path where indeed actual_arg_types
is uninitialized and our heuristic says that a const qualified pointer
is an input and thus might be read. So you get a maybe-uninitialized
diagnostic at the call.

GCC doesn't know that the 'nargs' argument relates to the array and
that at most 'nargs' (zero here) arguments are inspected.

So I think it works as designed, we have some duplicate bugreports
complaining about this "heuristic".

We are exposing this to ourselves by optimizing the args == 0 case
(skipping the initialization loop and constant propagating the
nargs argument). Aka jump-threading.

I think we just have to assume this incorrect warning will be around for
a while.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-09-06 17:04:22 Re: Eliminate redundant tuple visibility check in vacuum
Previous Message Peter Geoghegan 2023-09-06 16:20:23 Re: Eager page freeze criteria clarification