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/108733] -Wanalyzer-use-of-uninitialized-value false positives seen with __attribute__((cleanup))
Date: Thu, 09 Feb 2023 22:11:11 +0000	[thread overview]
Message-ID: <bug-108733-4-n3e6FqaUJU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108733-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:125b57aa67400388a496c2c0c40d9c8c55e0c94a

commit r13-5762-g125b57aa67400388a496c2c0c40d9c8c55e0c94a
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Thu Feb 9 17:09:51 2023 -0500

    analyzer: fix further overzealous state purging [PR108733]

    PR analyzer/108733 reports various false positives in qemu from
    -Wanalyzer-use-of-uninitialized-value with __attribute__((cleanup))
    at -O1 and above.

    Root cause is that the state-purging code was failing to treat:
       _25 = MEM[(void * *)&val];
    as a usage of "val", leading to it erroneously purging the
    initialization of "val" along an execution path that didn't otherwise
    use "val", apart from the  __attribute__((cleanup)).

    Fixed thusly.

    Integration testing on the patch show this change in the number of
    diagnostics:
      -Wanalyzer-use-of-uninitialized-value
           coreutils-9.1: 18 -> 16 (-2)
              qemu-7.2.0: 87 -> 80 (-7)
    where all that I investigated appear to have been false positives, hence
    an improvement.

    gcc/analyzer/ChangeLog:
            PR analyzer/108733
            * state-purge.cc (get_candidate_for_purging): Add ADDR_EXPR
            and MEM_REF.

    gcc/testsuite/ChangeLog:
            PR analyzer/108733
            * gcc.dg/analyzer/torture/uninit-pr108733.c: New test.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

  reply	other threads:[~2023-02-09 22:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 23:42 [Bug analyzer/108733] New: " dmalcolm at gcc dot gnu.org
2023-02-09 22:11 ` cvs-commit at gcc dot gnu.org [this message]
2023-02-09 22:18 ` [Bug analyzer/108733] " dmalcolm at gcc dot gnu.org
2023-03-29 18:19 ` cvs-commit at gcc dot gnu.org
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-108733-4-n3e6FqaUJU@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).