From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D557D3876897; Wed, 29 Mar 2023 18:19:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D557D3876897 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680113941; bh=Ntvvb6aYMfQ9hyF4t0D5cY0cl6Yh4HPeE/m1DEWVZN0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NbsIz+eDvMM++Vxbm92AgRoiDgQaZ7nlKdKAF/yrgwetFCKgCM1KHWXgMzHoTGggg rXv8MG5OKSS8Eu5jY93cNfCfwF1Z7GZJc+XGDwnXg6gCuUuFGzpj59lyZewUxz5piX sFHaGYz9eqstYLUMhnnXgR2nky9VT2kYD4/mi3cA= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/108704] Many -Wanalyzer-use-of-uninitialized-value false positives seen in qemu's softfloat.c Date: Wed, 29 Mar 2023 18:19:01 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D108704 --- Comment #5 from CVS Commits --- The releases/gcc-12 branch has been updated by David Malcolm : https://gcc.gnu.org/g:5da2126c4df8d83c2b2f9de7bb393ab4f5832840 commit r12-9364-g5da2126c4df8d83c2b2f9de7bb393ab4f5832840 Author: David Malcolm Date: Wed Mar 29 14:16:48 2023 -0400 analyzer: fix overzealous state purging with on-stack structs [PR108704] PR analyzer/108704 reports many false positives seen from -Wanalyzer-use-of-uninitialized-value on qemu's softfloat.c on code like the following: struct st s; s =3D foo (); s =3D bar (s); // bogusly reports that s is uninitialized here where e.g. "struct st" is "floatx80" in the qemu examples. The root cause is overzealous purging of on-stack structs in the code I added in r12-7718-gfaacafd2306ad7, where at: s =3D bar (s); state_purge_per_decl::process_point_backwards "sees" the assignment to = 's' and stops processing, effectively treating 's' as unneeded before this stmt, not noticing the use of 's' in the argument. Fixed thusly. The patch greatly reduces the number of -Wanalyzer-use-of-uninitialized-value warnings from my integration test= s: ImageMagick-7.1.0-57: 10 -> 6 (-4) qemu-7.2: 858 -> 87 (-771) haproxy-2.7.1: 1 -> 0 (-1) All of the above that I've examined appear to be false positives. Cherrypicked from r13-5745-g77bb54b1b07add. gcc/analyzer/ChangeLog: PR analyzer/108704 * state-purge.cc (state_purge_per_decl::process_point_backwards= ): Don't stop processing the decl if it's fully overwritten by this stmt if it's also used by this stmt. gcc/testsuite/ChangeLog: PR analyzer/108704 * gcc.dg/analyzer/uninit-7.c: New test. * gcc.dg/analyzer/uninit-pr108704.c: New test. Signed-off-by: David Malcolm =