From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3124A3858D39; Fri, 1 Jul 2022 01:49:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3124A3858D39 From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106155] New: [12/13 Regression] spurious "may be used uninitialized" warning Date: Fri, 01 Jul 2022 01:49:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-gcc at vinc17 dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 01:49:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106155 Bug ID: 106155 Summary: [12/13 Regression] spurious "may be used uninitialized" warning Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vincent-gcc at vinc17 dot net Target Milestone: --- With "-O -Wmaybe-uninitialized", I get a spurious "may be used uninitialize= d" on the following code on an x86_64 Debian/unstable machine: int *e; int f1 (void); void f2 (int); long f3 (void *, long, int *); void f4 (void *); int *fh; void tst (void) { int status; unsigned char badData[3][3] =3D { { 7 }, { 16 }, { 23 } }; int badDataSize[3] =3D { 1, 1, 1 }; int i; for (i =3D 0; i < 3; i++) { int emax; if (i =3D=3D 2) emax =3D f1 (); status =3D f3 (&badData[i][0], badDataSize[i], fh); if (status) { f1 (); f1 (); f1 (); } f4 (fh); *e =3D 0; f1 (); if (i =3D=3D 2) f2 (emax); } } Note that even a small change such as changing "long" to "int" as the second parameter of f3 makes the warning disappear. $ gcc-12 -O -Wmaybe-uninitialized -c -o tfpif.o tfpif.c tfpif.c: In function =E2=80=98tst=E2=80=99: tfpif.c:31:9: warning: =E2=80=98emax=E2=80=99 may be used uninitialized [-W= maybe-uninitialized] 31 | f2 (emax); | ^~~~~~~~~ tfpif.c:17:11: note: =E2=80=98emax=E2=80=99 was declared here 17 | int emax; | ^~~~ $ gcc-12 --version gcc-12 (Debian 12.1.0-5) 12.1.0 [...] $ gcc-snapshot -O -Wmaybe-uninitialized -c -o tfpif.o tfpif.c tfpif.c: In function 'tst': tfpif.c:31:9: warning: 'emax' may be used uninitialized [-Wmaybe-uninitiali= zed] 31 | f2 (emax); | ^~~~~~~~~ tfpif.c:17:11: note: 'emax' was declared here 17 | int emax; | ^~~~ $ gcc-snapshot --version gcc (Debian 20220630-1) 13.0.0 20220630 (experimental) [master r13-1359-gaa1ae74711b] [...] No such issue with: gcc-9 (Debian 9.5.0-1) 9.5.0 gcc-10 (Debian 10.4.0-1) 10.4.0 gcc-11 (Debian 11.3.0-4) 11.3.0 I detected this issue by testing GNU MPFR. The above code is derived from "tests/tfpif.c", function check_bad.=