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 middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50
Date: Tue, 19 Mar 2024 14:18:51 +0000	[thread overview]
Message-ID: <bug-113396-4-QBqPog1kOt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113396-4@http.gcc.gnu.org/bugzilla/>

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

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 #30 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's LIM2 which applies store-motion to m[0] but keeps m[p] in the loop.
Then with range-info for the int128 of [0, +INF] we get into
get_ref_base_and_extent:

                query = get_range_query (cfun);

                if (TREE_CODE (index) == SSA_NAME
                    && (low_bound = array_ref_low_bound (exp),
                        poly_int_tree_p (low_bound))
                    && (unit_size = array_ref_element_size (exp),
                        TREE_CODE (unit_size) == INTEGER_CST)
                    && query->range_of_expr (vr, index)
                    && !vr.varying_p ()
                    && !vr.undefined_p ())
                  {
                    wide_int min = vr.lower_bound ();
                    wide_int max = vr.upper_bound ();
                    poly_offset_int lbound = wi::to_poly_offset (low_bound);
                    /* Try to constrain maxsize with range information.  */
                    offset_int omax
                      = offset_int::from (max, TYPE_SIGN (TREE_TYPE (index)));
                    if (known_lt (lbound, omax))
                      {
                        poly_offset_int rmaxsize;
                        rmaxsize = (omax - lbound + 1)
                            * wi::to_offset (unit_size) << LOG2_BITS_PER_UNIT;
                        if (!known_size_p (maxsize)
                            || known_lt (rmaxsize, maxsize))

and compute rmaxsize == 0.

What's definitely questionable here is the offset_int::from, though it
fits.  But omax - lbound + 1 overflows to zero here.  It's probably
better to use widest-int here, even if that's possibly slower than
offset_int.  Or ensure offset_int has one more bit than required for
the index type (offset_int has 64bit + 3bits, so 128bits).

  parent reply	other threads:[~2024-03-19 14:18 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 11:53 [Bug c/113396] New: csmith: differences from -O2 to -O3 dcb314 at hotmail dot com
2024-01-15 12:16 ` [Bug c/113396] " dcb314 at hotmail dot com
2024-01-15 19:14 ` dcb314 at hotmail dot com
2024-01-15 19:15 ` dcb314 at hotmail dot com
2024-01-15 22:34 ` [Bug middle-end/113396] [13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-16  8:46 ` dcb314 at hotmail dot com
2024-01-16  9:30 ` dcb314 at hotmail dot com
2024-01-16  9:48 ` dcb314 at hotmail dot com
2024-01-16 10:22 ` dcb314 at hotmail dot com
2024-01-16 10:30 ` dcb314 at hotmail dot com
2024-01-17 17:28 ` jakub at gcc dot gnu.org
2024-01-17 17:32 ` dcb314 at hotmail dot com
2024-03-15 15:02 ` law at gcc dot gnu.org
2024-03-15 15:55 ` rguenth at gcc dot gnu.org
2024-03-15 15:58 ` rguenth at gcc dot gnu.org
2024-03-15 16:47 ` dcb314 at hotmail dot com
2024-03-15 16:57 ` jakub at gcc dot gnu.org
2024-03-15 17:15 ` dcb314 at hotmail dot com
2024-03-15 17:21 ` dcb314 at hotmail dot com
2024-03-15 21:07 ` dcb314 at hotmail dot com
2024-03-16 16:56 ` dcb314 at hotmail dot com
2024-03-16 18:33 ` dcb314 at hotmail dot com
2024-03-18  5:56 ` sjames at gcc dot gnu.org
2024-03-19  3:47 ` sjames at gcc dot gnu.org
2024-03-19  5:01 ` pinskia at gcc dot gnu.org
2024-03-19  5:16 ` pinskia at gcc dot gnu.org
2024-03-19  5:30 ` pinskia at gcc dot gnu.org
2024-03-19  5:30 ` pinskia at gcc dot gnu.org
2024-03-19  5:39 ` pinskia at gcc dot gnu.org
2024-03-19  5:41 ` pinskia at gcc dot gnu.org
2024-03-19  6:21 ` sjames at gcc dot gnu.org
2024-03-19  7:32 ` [Bug middle-end/113396] [13/14 Regression] csmith: differences from -O2 to -O3 since r13-1268-g8c99e307b20c50 sjames at gcc dot gnu.org
2024-03-19 14:18 ` rguenth at gcc dot gnu.org [this message]
2024-03-19 14:25 ` rguenth at gcc dot gnu.org
2024-03-20  8:22 ` cvs-commit at gcc dot gnu.org
2024-03-20  8:22 ` [Bug middle-end/113396] [13 " rguenth at gcc dot gnu.org
2024-05-08 11:49 ` cvs-commit at gcc dot gnu.org
2024-05-08 11:50 ` 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-113396-4-QBqPog1kOt@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).