From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5361C3852C73; Wed, 23 Nov 2022 16:38:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5361C3852C73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669221494; bh=foIkdP4JjmUqwgrcKvfm0KU01a5taqfMA5yYhdTR1QM=; h=From:To:Subject:Date:From; b=YkJiEvUlNi/L22BQKV+F+B3EankTSUjXT1vuHT877VG4zfsBlnfLS8PSZlvYR62YN Jrdzmz/CuHRIEBbRXIFtmKa1FQE7ve+Rxu/naReYVFGm9iCHW/UaRwZhVcA533QzIy HUXsP1epwG4gH1MWcYY+XVJtGXK+cKKP1KuWe9H4= From: "vincent-gcc at vinc17 dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107839] New: spurious "may be used uninitialized" warning while all uses are under "if (c)" Date: Wed, 23 Nov 2022 16:38:14 +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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107839 Bug ID: 107839 Summary: spurious "may be used uninitialized" warning while all uses are under "if (c)" 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: --- Consider int f (int); void g (int c) { int v; if (c) v =3D f(0); while (1) if (c) f(v + v); } $ gcc-test -O -Wmaybe-uninitialized -c tst2.c tst2.c: In function =E2=80=98g=E2=80=99: tst2.c:4:7: warning: =E2=80=98v=E2=80=99 may be used uninitialized [-Wmaybe= -uninitialized] 4 | int v; | ^ All uses of v are under "if (c)", so the warning is incorrect. Note that replacing "v + v" by "v" makes the warning disappear. This occurs with GCC 8.4.0 and above up to at least 13.0.0 20220906 (experimental) from the master branch. No warnings with GCC 6.5.0 and below. Note to myself (to check once this bug is fixed): this testcase is derived = from tmd/binary32/hrcases.c (warning on variable t0).=