public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/95757] [11 regression] missing warning in gcc.dg/Wstringop-overflow-25.c since r11-1517
Date: Tue, 02 Mar 2021 10:49:59 +0000	[thread overview]
Message-ID: <bug-95757-4-Uvnz6R5Yoj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95757-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:ff92ede8d269375f800e1b347a48f4698874b4a3

commit r11-7448-gff92ede8d269375f800e1b347a48f4698874b4a3
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 2 11:49:12 2021 +0100

    vrp: Improve register_edge_assert_for [PR95757]

    The Wstringop-overflow-25.c testcase doesn't emit one of the expected
    warnings on targets that don't do short curcuiting due to target costs
    (or e.g. with --param=logical-op-non-short-circuit=0 on all targets).

    The problem is that only reassoc2 optimizes:
      _49 ={v} unsigned_value_source;
      if (_49 == 0)
        goto <bb 7>; [50.00%]
      else
        goto <bb 5>; [50.00%]

      <bb 5> [local count: 536870913]:
      if (_49 > 2)
        goto <bb 7>; [50.00%]
      else
        goto <bb 6>; [50.00%]

      <bb 6> [local count: 268435457]:
      _53 = _49 + 1;
    into:
      _49 ={v} unsigned_value_source;
      _48 = _49 + 18446744073709551615;
      _1 = _48 > 1;
      if (_1 != 0)
        goto <bb 6>; [50.00%]
      else
        goto <bb 5>; [50.00%]

      <bb 5> [local count: 268435457]:
      _53 = _49 + 1;
    (but, note the _1 = _48 > 1; if (_1 != 0)),
    then dom3 is run and because of that if (_1 != 0) vs. if (_48 > 1) doesn't
    register edge asserts for _48 and _49) and so we don't get
    SSA_NAME_RANGE_INFO for _53 (and ditto for vrp2) and only afterwards comes
    forwprop4 that canonicalizes it to if (_48 > 1).  While with
    --param=logical-op-non-short-circuit=1 it is already reassoc1 that
optimizes
    it and forwprop3 that propagates it, so we have on the SSA_NAME
    corresponding to _53 above SSA_NAME_RANGE_INFO and during expansion we
warn.

    The following patch fixes it by handling those not yet propagated
    comparisons into GIMPLE_COND in register_edge_assert_for.  We already
    have all the infrastructure there to handle the
--param=logical-op-non-short-circuit=1
    | and &s.

    2021-03-02  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/95757
            * tree-vrp.c (register_edge_assert_for): Remove superfluous ()s
around
            condition.  Call register_edge_assert_for_1 for == 0, != 0, == 1
and
            != 1 comparisons if name is lhs of a comparison.

  parent reply	other threads:[~2021-03-02 10:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19  2:05 [Bug middle-end/95757] New: " seurer at linux dot vnet.ibm.com
2020-06-19  7:23 ` [Bug middle-end/95757] " rguenth at gcc dot gnu.org
2020-06-19  7:35 ` clyon at gcc dot gnu.org
2020-08-13 15:33 ` seurer at gcc dot gnu.org
2020-10-16 11:53 ` rguenth at gcc dot gnu.org
2020-10-16 12:03 ` clyon at gcc dot gnu.org
2020-12-16 18:14 ` seurer at gcc dot gnu.org
2021-02-23  2:59 ` hp at gcc dot gnu.org
2021-02-26 12:12 ` rguenth at gcc dot gnu.org
2021-03-01 14:48 ` jakub at gcc dot gnu.org
2021-03-01 17:59 ` jakub at gcc dot gnu.org
2021-03-02 10:49 ` cvs-commit at gcc dot gnu.org [this message]
2021-03-02 10:55 ` jakub 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-95757-4-Uvnz6R5Yoj@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).