public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-108704-4-79RXhXtChj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108704-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108704

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by David Malcolm
<dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:5da2126c4df8d83c2b2f9de7bb393ab4f5832840

commit r12-9364-g5da2126c4df8d83c2b2f9de7bb393ab4f5832840
Author: David Malcolm <dmalcolm@redhat.com>
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 = foo ();
       s = 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 = 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 tests:
      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 <dmalcolm@redhat.com>

  parent reply	other threads:[~2023-03-29 18:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 23:13 [Bug analyzer/108704] New: " dmalcolm at gcc dot gnu.org
2023-02-07 23:14 ` [Bug analyzer/108704] [13 Regression] " dmalcolm at gcc dot gnu.org
2023-02-07 23:30 ` dmalcolm at gcc dot gnu.org
2023-02-08 18:48 ` cvs-commit at gcc dot gnu.org
2023-02-08 18:58 ` [Bug analyzer/108704] " dmalcolm at gcc dot gnu.org
2023-03-29 18:19 ` cvs-commit at gcc dot gnu.org [this message]
2023-03-29 19:31 ` dmalcolm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108704-4-79RXhXtChj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).