[gcc(refs/users/aoliva/heads/testme)] adjust shiftrt bitpos for endianness
Alexandre Oliva
aoliva@gcc.gnu.org
Thu Sep 17 11:43:10 GMT 2020
https://gcc.gnu.org/g:a463d049a6b67fdac6c730d37eaeb8b2ea9173fd
commit a463d049a6b67fdac6c730d37eaeb8b2ea9173fd
Author: Alexandre Oliva <oliva@gnu.org>
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;
}
More information about the Gcc-cvs
mailing list