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  <br...@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.


Reply via email to