From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 22CAD3858005; Fri, 3 Mar 2023 18:29:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22CAD3858005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677868195; bh=AkBEJ1zSZdEzKvrhOB0+LqmUly2Ti1YEWW5TcIYVF9o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WG3hWIIG7jOsBQ+ElvtKmab947oqc8u/5/Ifi9ITXTMViCPt6BYYB06uHP3gTzrkD eUGZlMj+5ETtukwL7viScRRJqNf3FonFRLmq9JtOYkn9TqJHUFj4uLyQqmy8oSFbfJ RMmI09gGu4ru8p0kVpR44OILg/YdxpXN13AvgDBE= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109014] -Wanalyzer-use-of-uninitialized-value seen in pcre2-10.42's pcre2test.c Date: Fri, 03 Mar 2023 18:29:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: 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=3D109014 --- Comment #1 from David Malcolm --- I believe the issue here is that: * display_properties partially initializes the "found" buffer, writing a -1 terminator at the end of the initialized part at: fv[m] =3D -1; * display_properties then calls format_list_item, which tries to find the terminator with: for (count =3D 0; ff[count] >=3D 0; count++) { * -fanalyzer isn't smart enough to know that a -1 terminator has been writt= en, and simulates iterating past the end of the initialized region and this is currently masked by the "sprintf" call, which in the absence of= a known_function implementation is currently assumed to potentially write to = fv.=