public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/40635] bogus name and location in 'may be used uninitialized' warning
Date: Wed, 15 Dec 2021 18:43:32 +0000	[thread overview]
Message-ID: <bug-40635-4-spSFu20HiA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-40635-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #16 from Martin Sebor <msebor at gcc dot gnu.org> ---
With the patch in comment #13 committed in
g:9695e1c23be5b5c55d572ced152897313ddb96ae GCC 12 prints the following for the
test case in comment #0:

pr40635.c: In function ‘server_init’:
pr40635.c:14:9: warning: ‘s42’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
   14 |     int s42, x;
      |         ^~~

But it doesn't show where the uninitialized variable is used.  GCC 11 only
points to the variable's use but doesn't say which variable it is:

pr40635.c: In function ‘server_init’:
pr40635.c:39:8: warning: ‘s42’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
   39 |     if (sockt_rd < 0)
      |        ^

So things have gotten both better and worse.

The reason why the GCC 12 warning doesn't point to the use is because the use
statement (_28 = _16 < 0; in basic block 8 below) has no location:

  <bb 8> [local count: 1073741824]:
  # _16 = PHI <[pr40635.c:22:20] -1(12), s42_9(7), [pr40635.c:29:16] -1(14),
s42_18(D)(11), s42_9(13)>
  [pr40635.c:38:5] foo ();
  _28 = _16 < 0;
  _5 = (int) _28;
  _4 = -_5;
  return _4;

The location can still be found in the mergephi3 dump
(pr40635.c.120t.mergephi3) and is gone from the phiopt2 dump
(pr40635.c.121t.phiopt2):

  <bb 8> [local count: 5226752]:

  <bb 9> [local count: 1073741824]:
  # _16 = PHI <[../pr40635.c:22:20] -1(3), [../pr40635.c:30:12] s42_20(7),
[../pr40635.c:29:16] -1(8)>
  [../pr40635.c:38:5] foo ();
  [../pr40635.c:39:8] if (_16 < 0)
    goto <bb 10>; [0.73%]
  else
    goto <bb 11>; [99.27%]

  <bb 10> [local count: 7838309]:

  <bb 11> [local count: 1073741824]:
  # _1 = PHI <[../pr40635.c:40:16] -1(10), [../pr40635.c:41:12] 0(9)>
  return _1;

}

  parent reply	other threads:[~2021-12-15 18:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-40635-4@http.gcc.gnu.org/bugzilla/>
2013-11-01 21:56 ` manu at gcc dot gnu.org
2013-12-19 10:17 ` manu at gcc dot gnu.org
2013-12-19 10:40 ` philipp at marek dot priv.at
2013-12-19 10:51 ` manu at gcc dot gnu.org
2013-12-19 10:57 ` philipp at marek dot priv.at
2013-12-19 10:59 ` philipp at marek dot priv.at
2021-03-25 21:07 ` msebor at gcc dot gnu.org
2021-03-25 21:08 ` msebor at gcc dot gnu.org
2021-03-25 22:40 ` msebor at gcc dot gnu.org
2021-12-15 18:43 ` msebor at gcc dot gnu.org [this message]
2021-12-15 18:48 ` [Bug tree-optimization/40635] [12 Regression] " msebor at gcc dot gnu.org
2021-12-15 19:00 ` msebor at gcc dot gnu.org
2021-12-15 19:14 ` pinskia at gcc dot gnu.org
2021-12-18 10:46 ` pinskia at gcc dot gnu.org
2022-01-21 13:56 ` rguenth at gcc dot gnu.org
2022-03-17 19:25 ` msebor at gcc dot gnu.org
2022-03-17 22:00 ` pinskia at gcc dot gnu.org
2022-05-06  8:29 ` [Bug tree-optimization/40635] [12/13 " jakub at gcc dot gnu.org
2022-11-20  3:11 ` law at gcc dot gnu.org
2022-12-05 15:00 ` rguenth at gcc dot gnu.org
2022-12-05 15:51 ` cvs-commit at gcc dot gnu.org
2023-05-08 12:21 ` [Bug tree-optimization/40635] [12 " rguenth 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-40635-4-spSFu20HiA@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).