https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111240
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |11.4.0 Status|UNCONFIRMED |NEW Summary|Incorrect warning from |[12/13/14 Regression] |-Wmaybe-uninitialized |Incorrect warning from | |-Wmaybe-uninitialized Last reconfirmed|2023-08-30 00:00:00 |2023-08-31 Target Milestone|--- |12.4 Known to fail| |12.1.0, 12.2.0, 13.2.0, | |14.0 Keywords| |needs-reduction Ever confirmed|0 |1 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- 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.