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/101912] -Wmaybe-uninitialized false alarm in tzdb localtime.c
Date: Mon, 16 Aug 2021 17:07:17 +0000	[thread overview]
Message-ID: <bug-101912-4-wGWwLhVv8Q@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101912-4@http.gcc.gnu.org/bugzilla/>

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |10.3.0, 11.2.0, 12.0,
                   |                            |6.5.0, 7.5.0, 8.5.0, 9.3.0
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
                 CC|                            |msebor at gcc dot gnu.org
   Last reconfirmed|                            |2021-08-16

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed, not a regression.  The warning pass considers only one condition: n
> 0.  It doesn't consider the conjunction of that condition with those implied
by not using the other unintialized PHI operand and that the use is unreachable
otherwise (i.e., that !(corr == 1 && leapcnt != 0 && prevcorr - 1 > 1 && n !=
leapcnt) cannot be true at the point of the use).  The logic seem too
complicated to me to figure it out but I could be missing something.

int tzloadbody ()
{
  int corr;
  int leapcnt;
  int prevcorr;
  int n;
  _Bool _1;
  _Bool _2;
  _Bool _5;
  unsigned int _6;
  int _8;
  unsigned int _9;
  _Bool _21;
  _Bool _27;

  <bb 2> [local count: 95397018]:
  # .MEM_12 = VDEF <.MEM_11(D)>
  n_13 = getint ();
  if (n_13 > 0)
    goto <bb 7>; [96.34%]                               >>> if n > 0...
  else
    goto <bb 9>; [3.66%]

  <bb 7> [local count: 91905487]:                       <<<
...prevcorr_14(D)(7) uninitialized here

  <bb 3> [local count: 1034442874]:                     <<< if n > 0 && !(corr
== 1 && leapcnt != 0 && prevcorr - 1 > 1 && n != leapcnt)
  # prevcorr_18 = PHI <corr_16(8), prevcorr_14(D)(7)>   <<< 
  # leapcnt_23 = PHI <leapcnt_17(8), 0(7)>
  # .MEM_20 = PHI <.MEM_15(8), .MEM_12(7)>
  # .MEM_15 = VDEF <.MEM_20>
  corr_16 = getint ();
  if (corr_16 <= 0)
    goto <bb 10>; [3.66%]
  else
    goto <bb 4>; [96.34%]

  <bb 4> [local count: 996582264]:
  _1 = corr_16 == 1;
  _2 = leapcnt_23 != 0;
  _9 = (unsigned int) prevcorr_18;                       <<<
-Wmaybe-uninitialized
  _6 = _9 + 4294967295;
  _5 = _6 > 1;
  _21 = _1 & _2;
  _27 = _5 & _21;
  if (_27 != 0)
    goto <bb 11>; [21.78%]
  else
    goto <bb 5>; [78.22%]                               >>> corr == 1 &&
leapcnt != 0 && prevcorr - 1 > 1

  <bb 11> [local count: 217055616]:
  goto <bb 6>; [100.00%]

  <bb 5> [local count: 978344809]:
  leapcnt_17 = leapcnt_23 + 1;
  if (n_13 != leapcnt_17)
    goto <bb 8>; [96.34%]                               >>> corr == 1 &&
leapcnt != 0 && prevcorr - 1 > 1 && n != leapcnt
  else
    goto <bb 12>; [3.66%]

  <bb 12> [local count: 35807421]:
  goto <bb 6>; [100.00%]

  <bb 8> [local count: 942537388]:
  goto <bb 3>; [100.00%]                                >>> corr == 1 &&
leapcnt != 0 && prevcorr - 1 > 1 && n != leapcnt

  <bb 9> [local count: 3491531]:

  <bb 6> [local count: 95397019]:
  # _8 = PHI <0(9), n_13(12), -1(11), -1(10)>
  # .MEM_10 = PHI <.MEM_12(9), .MEM_15(12), .MEM_15(11), .MEM_15(10)>
  # VUSE <.MEM_10>
  return _8;

}

  reply	other threads:[~2021-08-16 17:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14 19:27 [Bug tree-optimization/101912] New: " eggert at cs dot ucla.edu
2021-08-16 17:07 ` msebor at gcc dot gnu.org [this message]
2021-11-30 15:41 ` [Bug tree-optimization/101912] " aldyh at gcc dot gnu.org
2021-11-30 16:02 ` aldyh at gcc dot gnu.org
2021-11-30 16:47 ` eggert at cs dot ucla.edu
2021-12-01  7:49 ` rguenther at suse dot de
2021-12-01 16:22 ` aldyh at gcc dot gnu.org
2022-12-25  0:06 ` pinskia at gcc dot gnu.org
2022-12-27 12:26 ` marxin at gcc dot gnu.org
2023-01-09 10:02 ` rguenth at gcc dot gnu.org
2023-01-09 11:19 ` cvs-commit at gcc dot gnu.org
2023-01-09 11:20 ` rguenth at gcc dot gnu.org
2023-04-12 13:30 ` sjames at gcc dot gnu.org
2023-04-12 13:31 ` sjames at gcc dot gnu.org
2023-04-26  6:55 ` rguenth at gcc dot gnu.org
2023-07-04  9:19 ` rguenth at gcc dot gnu.org
2023-07-04  9:19 ` 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-101912-4-wGWwLhVv8Q@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).