From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1C5B83858D37; Thu, 31 Aug 2023 09:46:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C5B83858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693475206; bh=oUlIKMtt+a4/+4hfPTjFhSAQU5q9hbCfg2PvCchpdX4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=J0JSB6/yw6GGyNlHYHNFVd+rjSKHuHxFAr57rw4CXWNT7fwf83qrnHqYufRFQc+sb 9wCfQvLBBCLKnrbh/Y61ld6Tq6hCMgmYT2HPax3UlRPHVplpICiL4Crhfp8K/HuUW/ licaDbRlmsGfUFaabdeJztd2CRBEX5ZDjnQkzZA8= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111240] [12/13/14 Regression] Incorrect warning from -Wmaybe-uninitialized Date: Thu, 31 Aug 2023 09:46:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic, needs-reduction X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_known_to_work bug_status short_desc cf_reconfirmed_on target_milestone cf_known_to_fail keywords everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111240 Richard Biener 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 --- Confirmed. rettype_58 =3D enforce_generic_type_consistency (&actual_arg_types, &declared_arg_types, 0, _56, 0); and we reach this on the args =3D=3D 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 =3D=3D 0 case (skipping the initialization loop and constant propagating the nargs argument). Aka jump-threading.=