public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r15-34] Verify that reading back from vrange_storage doesn't drop bits. Date: Sun, 28 Apr 2024 19:04:20 +0000 (GMT) [thread overview] Message-ID: <20240428190420.BB31D3858D37@sourceware.org> (raw) https://gcc.gnu.org/g:92f74ee21218cab08d7bb7769004a65e8a291fa3 commit r15-34-g92f74ee21218cab08d7bb7769004a65e8a291fa3 Author: Aldy Hernandez <aldyh@redhat.com> Date: Tue Mar 19 16:35:41 2024 +0100 Verify that reading back from vrange_storage doesn't drop bits. We have a sanity check in the irange storage code to make sure that reading back a cache entry we have just written to yields exactly the same range. There's no need to do this only for integers. This patch moves the code to a more generic place. However, doing so tickles a latent bug in the frange code where a range is being pessimized from [0.0, 1.0] to [-0.0, 1.0]. Exclude checking frange's until this bug is fixed. gcc/ChangeLog: * value-range-storage.cc (irange_storage::set_irange): Move verification code from here... (vrange_storage::set_vrange): ...to here. Diff: --- gcc/value-range-storage.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc index f00474ad0e6..09a29776a0e 100644 --- a/gcc/value-range-storage.cc +++ b/gcc/value-range-storage.cc @@ -165,6 +165,19 @@ vrange_storage::set_vrange (const vrange &r) } else gcc_unreachable (); + + // Verify that reading back from the cache didn't drop bits. + if (flag_checking + // FIXME: Avoid checking frange, as it currently pessimizes some ranges: + // + // gfortran.dg/pr49472.f90 pessimizes [0.0, 1.0] into [-0.0, 1.0]. + && !is_a <frange> (r) + && !r.undefined_p ()) + { + Value_Range tmp (r); + get_vrange (tmp, r.type ()); + gcc_checking_assert (tmp == r); + } } // Restore R from storage. @@ -306,13 +319,6 @@ irange_storage::set_irange (const irange &r) irange_bitmask bm = r.m_bitmask; write_wide_int (val, len, bm.value ()); write_wide_int (val, len, bm.mask ()); - - if (flag_checking) - { - int_range_max tmp; - get_irange (tmp, r.type ()); - gcc_checking_assert (tmp == r); - } } static inline void
reply other threads:[~2024-04-28 19:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240428190420.BB31D3858D37@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).