From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 232773856DEA; Tue, 9 Aug 2022 19:51:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 232773856DEA From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/106573] New: Missing -Wanalyzer-use-of-uninitialized-value on calls handled by state machines Date: Tue, 09 Aug 2022 19:51:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm 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 cc 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: Tue, 09 Aug 2022 19:51:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106573 Bug ID: 106573 Summary: Missing -Wanalyzer-use-of-uninitialized-value on calls handled by state machines Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org CC: mir at gcc dot gnu.org Target Milestone: --- Consider: int dup (int old_fd); int not_dup (int old_fd); int test_1 () { int m; return dup (m); } int test_2 () { int m; return not_dup (m); } where in each function uninitialized local "m" is passed to an externally-defined function. -fanalyzer currently emits: t.c: In function =E2=80=98test_1=E2=80=99: t.c:8:10: warning: =E2=80=98dup=E2=80=99 on possibly invalid file descripto= r =E2=80=98m=E2=80=99 [-Wanalyzer-fd-use-without-check] 8 | return dup (m); | ^~~~~~~ =E2=80=98test_1=E2=80=99: event 1 | | 8 | return dup (m); | | ^~~~~~~ | | | | | (1) =E2=80=98m=E2=80=99 could be invalid | t.c: In function =E2=80=98test_2=E2=80=99: t.c:15:10: warning: use of uninitialized value =E2=80=98m=E2=80=99 [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 15 | return not_dup (m); | ^~~~~~~~~~~ =E2=80=98test_2=E2=80=99: events 1-2 | | 14 | int m; | | ^ | | | | | (1) region created on stack here | 15 | return not_dup (m); | | ~~~~~~~~~~~ | | | | | (2) use of uninitialized value =E2=80=98m=E2=80=99 he= re | where it only complains about uninit m being passed to not_dup. Looks like we're missing a check for poisoned svalues as params for the case where one of the state machines recognizes the function in question.=