public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug analyzer/94732] Analyzer: false positive in MPFR's atan.c
Date: Thu, 23 Apr 2020 18:36:05 +0000	[thread overview]
Message-ID: <bug-94732-4-lIuZ5hDUWS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94732-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Here's the corresponding simple testcase:

typedef struct { int *a; } S;
int *f (void);
static void g (S *x)
{
  int *p = x->a;
  p[0] = 0;
}
void h (void)
{
  S x[1];
  x->a = f ();
  g (x);
}

$ gcc-10 -c -fanalyzer bug.i
bug.i: In function ‘g’:
bug.i:6:8: warning: use of uninitialized value ‘p’ [CWE-457]
[-Wanalyzer-use-of-uninitialized-value]
    6 |   p[0] = 0;
      |   ~~~~~^~~
  ‘h’: events 1-2
    |
    |    8 | void h (void)
    |      |      ^
    |      |      |
    |      |      (1) entry to ‘h’
    |......
    |   12 |   g (x);
    |      |   ~~~~~
    |      |   |
    |      |   (2) calling ‘g’ from ‘h’
    |
    +--> ‘g’: events 3-4
           |
           |    3 | static void g (S *x)
           |      |             ^
           |      |             |
           |      |             (3) entry to ‘g’
           |......
           |    6 |   p[0] = 0;
           |      |   ~~~~~~~~   
           |      |        |
           |      |        (4) use of uninitialized value ‘p’ here
           |

  reply	other threads:[~2020-04-23 18:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 14:58 [Bug analyzer/94732] New: " vincent-gcc at vinc17 dot net
2020-04-23 18:36 ` vincent-gcc at vinc17 dot net [this message]
2020-04-28 13:26 ` [Bug analyzer/94732] " cvs-commit at gcc dot gnu.org
2020-04-28 13:34 ` 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-94732-4-lIuZ5hDUWS@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).