public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/67196] [10/11/12/13 Regression] loop-induced false positive from -Wmaybe-uninitialized
Date: Tue, 30 Aug 2022 09:40:38 +0000	[thread overview]
Message-ID: <bug-67196-4-bZFAoSigdv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67196-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that the code supposed to deal with this,
uninit_analysis::overlap,
does not handle the case of chained PHIs very well, that is,

<bb 5> [local count: 955630225]:
# num_captions_in_row_5 = PHI <num_captions_in_row_25(11),
num_captions_in_row_18(4)>
# first_caption_7 = PHI <first_caption_27(11), 1(4)>
# first_caption_idx_9 = PHI <first_caption_idx_29(11), i_31(4)>
i_19 = i_31 + 1;
if (n_16(D) != i_19)
  goto <bb 12>; [89.00%]
else
  goto <bb 6>; [11.00%]

...

<bb 6> [local count: 105119324]:
_2 = first_caption_7 != 0;
_3 = num_captions_in_row_5 == 1;
_4 = _2 & _3;
if (_4 != 0)
  goto <bb 7>; [38.20%]
else
  goto <bb 13>; [61.80%]

...

<bb 8> [local count: 118111600]:
# _12 = PHI <first_caption_idx_9(7), 0(13), 0(10)>
return _12;

the code searchess for a PHI definition of num_captions_in_row_5 in the
same block as the _12 = PHI <>, not realizing that uninit analysis
also includes edges from the _9 = PHI <> in BB5 where the definition
ultimatively resides.

Then there's the issue that use predicates are not yet normalized at
this point so there's still the _4 != 0 test instead of the two ANDed
ones.

With both fixed the diagnostic is gone.

  parent reply	other threads:[~2022-08-30  9:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 19:03 [Bug tree-optimization/67196] New: Another " dmalcolm at gcc dot gnu.org
2015-08-12 20:26 ` [Bug tree-optimization/67196] " manu at gcc dot gnu.org
2021-03-31 19:44 ` [Bug tree-optimization/67196] [9/10/11 Regression] loop-induced " msebor at gcc dot gnu.org
2021-04-08 14:24 ` rguenth at gcc dot gnu.org
2021-06-01  8:06 ` [Bug tree-optimization/67196] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-01-21 13:53 ` rguenth at gcc dot gnu.org
2022-05-27  9:35 ` [Bug tree-optimization/67196] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:31 ` jakub at gcc dot gnu.org
2022-08-30  9:40 ` rguenth at gcc dot gnu.org [this message]
2022-08-30 11:15 ` cvs-commit at gcc dot gnu.org
2022-11-20  3:56 ` [Bug tree-optimization/67196] [10/11/12 " law at gcc dot gnu.org
2022-11-21  6:47 ` rguenth at gcc dot gnu.org
2023-07-07  7:28 ` [Bug tree-optimization/67196] [11/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-67196-4-bZFAoSigdv@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).