From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id E349F386EC3E; Thu, 17 Sep 2020 11:43:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E349F386EC3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600342990; bh=eHcLMFPsA3hQLXYsXi1N0sjbfTU6XOAE5o+pm90ks0E=; h=From:To:Subject:Date:From; b=AJ0tttEmWQ/Qq+rYD6yVGp7remqb0CA21OweKtDIunofyAWtdgGWUZj7TXOyXZ8ws grDCJcQpo/UBtn07/LVlBPFDxtlj+It27v8JmU1wcNzXASEAOaDGKLlRQWoa6Kc16y EqCg5uiT1+FVAV478PIYtCHj38jdly6DJOu/C9as= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] adjust shiftrt bitpos for endianness X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 0dc8eabc87885d6eb5b395ac2c43aafec59fdcc9 X-Git-Newrev: a463d049a6b67fdac6c730d37eaeb8b2ea9173fd Message-Id: <20200917114310.E349F386EC3E@sourceware.org> Date: Thu, 17 Sep 2020 11:43:10 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2020 11:43:11 -0000 https://gcc.gnu.org/g:a463d049a6b67fdac6c730d37eaeb8b2ea9173fd commit a463d049a6b67fdac6c730d37eaeb8b2ea9173fd Author: Alexandre Oliva 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 c835327dac9..d65d4a79816 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; }