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/92539] [8/9/10/11 Regression] -Warray-bounds false positive with -O3 (loop unroll?)
Date: Sun, 14 Feb 2021 00:14:55 +0000	[thread overview]
Message-ID: <bug-92539-4-TjVPZ0j8Q7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92539-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
>From the vrp1 dump it seems that it should be possible to determine that bb 8
and later are unreachable.  Might the predicate analysis help here as well?

int main ()
{
  const char * last;
  int i;
  const char * local_iterator;
  const char * in;
  int _3;
  char _5;
  bool iftmp.0_13;

  <bb 2> [local count: 118111600]:
  goto <bb 4>; [100.00%]

  <bb 3> [local count: 955630225]:
  last_4 = last_2 + 1;

  <bb 4> [local count: 1073741824]:
  # last_2 = PHI <"aa"(2), last_4(3)>
  _5 = *last_2;
  if (_5 != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 5>; [11.00%]                                    <<< *last_2 ==
'\0' implies last_2 == "aa" + 2

  <bb 5> [local count: 118111600]:
  # last_12 = PHI <last_2(4)>
  if (last_12 != "aa")                                       <<< true
    goto <bb 6>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 6> [local count: 64477123]:
  if (last_12 != &MEM <const char[3]> [(void *)"aa" + 1B])   <<< true
    goto <bb 7>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 7> [local count: 55926445]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 2B])      <<< false
    goto <bb 8>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 8> [local count: 30530247]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 3B])
    goto <bb 9>; [54.59%]
  else
    goto <bb 12>; [45.41%]


  <bb 10> [local count: 14456228]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 5B])
    goto <bb 11>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 11> [local count: 59055800]:
  if (last_12 == &MEM <const char> [(void *)"aa" + 6B])
    goto <bb 13>; [30.00%]
  else
    goto <bb 12>; [70.00%]

  <bb 12> [local count: 100394860]:

  <bb 13> [local count: 118111600]:
  # iftmp.0_13 = PHI <0(12), 1(11)>
  _3 = (int) iftmp.0_13;
  return _3;

}

  parent reply	other threads:[~2021-02-14  0:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-92539-4@http.gcc.gnu.org/bugzilla/>
2020-08-20 17:16 ` msebor at gcc dot gnu.org
2021-02-14  0:14 ` msebor at gcc dot gnu.org [this message]
2021-02-14 13:59 ` law at redhat dot com
2021-05-14  9:52 ` [Bug tree-optimization/92539] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:15 ` rguenth at gcc dot gnu.org
2022-05-27  9:41 ` [Bug tree-optimization/92539] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:38 ` jakub at gcc dot gnu.org
2023-07-07 10:36 ` [Bug tree-optimization/92539] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-05-14 19:41 ` [Bug tree-optimization/92539] [11/12/13/14/15 " law 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-92539-4-TjVPZ0j8Q7@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).