public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] adjust shiftrt bitpos for endianness
Date: Wed, 23 Sep 2020 23:23:45 +0000 (GMT)	[thread overview]
Message-ID: <20200923232345.86B6C395181A@sourceware.org> (raw)

https://gcc.gnu.org/g:118e7820efa48cf141be3b750ba10ea042e69025

commit 118e7820efa48cf141be3b750ba10ea042e69025
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Sep 17 08:29:24 2020 -0300

    adjust shiftrt bitpos for endianness

Diff:
---
 gcc/fold-const.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 081c41f7fbe..e39ab42049e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4686,7 +4686,7 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
   if ((inner == exp && and_mask == 0)
       || !poly_bitsize.is_constant (pbitsize)
       || !poly_bitpos.is_constant (pbitpos)
-      || *pbitsize < shiftrt
+      || *pbitsize <= shiftrt
       || offset != 0
       || TREE_CODE (inner) == PLACEHOLDER_EXPR
       /* Reject out-of-bound accesses (PR79731).  */
@@ -4697,7 +4697,8 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
 
   if (shiftrt)
     {
-      *pbitpos += shiftrt;
+      if (!*preversep ? !BYTES_BIG_ENDIAN : BYTES_BIG_ENDIAN)
+	*pbitpos += shiftrt;
       *pbitsize -= shiftrt;
     }


             reply	other threads:[~2020-09-23 23:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 23:23 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-17 11:43 Alexandre Oliva
2020-09-17 11:31 Alexandre Oliva

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=20200923232345.86B6C395181A@sourceware.org \
    --to=aoliva@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: 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).