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 tree-optimization/111303] [14 Regression] ICE: in type, at value-range.h:869
Date: Wed, 13 Sep 2023 01:32:06 +0000	[thread overview]
Message-ID: <bug-111303-4-IDmxz654r5@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111303-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jiu Fu Guo <guojiufu@gcc.gnu.org>:

https://gcc.gnu.org/g:8d8bc560b6ab7f3153db23ffb37157528e5b2c9a

commit r14-3913-g8d8bc560b6ab7f3153db23ffb37157528e5b2c9a
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Wed Sep 6 21:38:11 2023 +0800

    Checking undefined_p before using the vr

    For pattern "(X + C) / N": "div (plus@3 @0 INTEGER_CST@1) INTEGER_CST@2)",
    Even if "X" has value-range and "X + C" does not overflow, "@3" may still
    be undefined. Like below example:

    _3 = _2 + -5;
    if (0 != 0)
      goto <bb 3>; [34.00%]
    else
      goto <bb 4>; [66.00%]
    ;;  succ:       3
    ;;              4

    ;; basic block 3, loop depth 0
    ;;  pred:       2
    _5 = _3 / 5;
    ;;  succ:       4

    The whole pattern "(_2 + -5 ) / 5" is in "bb 3", but "bb 3" would be
    unreachable (because "if (0 != 0)" is always false).
    And "get_range_query (cfun)->range_of_expr (vr3, @3)" is checked in
    "bb 3", "range_of_expr" gets an "undefined vr3". Where "@3" is "_5".

    So, before using "vr3", it would be safe to check "!vr3.undefined_p ()".

            PR tree-optimization/111303

    gcc/ChangeLog:

            * match.pd ((X - N * M) / N): Add undefined_p checking.
            ((X + N * M) / N): Likewise.
            ((X + C) div_rshift N): Likewise.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr111303.c: New test.

  parent reply	other threads:[~2023-09-13  1:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06  8:24 [Bug c/111303] New: " shaohua.li at inf dot ethz.ch
2023-09-06  9:21 ` [Bug c/111303] " shaohua.li at inf dot ethz.ch
2023-09-06 11:12 ` guojiufu at gcc dot gnu.org
2023-09-06 11:13 ` guojiufu at gcc dot gnu.org
2023-09-06 12:36 ` guojiufu at gcc dot gnu.org
2023-09-06 12:47 ` guojiufu at gcc dot gnu.org
2023-09-06 22:52 ` [Bug tree-optimization/111303] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-09 16:03 ` pinskia at gcc dot gnu.org
2023-09-09 16:04 ` pinskia at gcc dot gnu.org
2023-09-13  1:32 ` cvs-commit at gcc dot gnu.org [this message]
2023-09-18  2:19 ` cvs-commit at gcc dot gnu.org
2023-09-18  2:31 ` guojiufu at gcc dot gnu.org
2023-09-18  2:38 ` guojiufu 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-111303-4-IDmxz654r5@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).