From b231822daedfc5cf7dbacda8208daff722519776 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 2 Nov 2016 16:03:13 +0000 Subject: [PATCH] Fix for big-endian gcc.c-torture/execute/pr55750.c * gimple-ssa-store-merging.c (encode_tree_to_bitpos): Don't forget to clear padding bits even when they're less than a byte. From-SVN: r241798 --- gcc/ChangeLog | 5 +++++ gcc/gimple-ssa-store-merging.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 241ff78d555..96bcf4110f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-11-02 Kyrylo Tkachov + + * gimple-ssa-store-merging.c (encode_tree_to_bitpos): Don't forget to + clear padding bits even when they're less than a byte. + 2016-11-02 Richard Biener * gimple-ssa-store-merging.c: Include gimplify-me.h. diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index 1bca4a13758..36bc833af91 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -431,7 +431,8 @@ encode_tree_to_bitpos (tree expr, unsigned char *ptr, int bitlen, int bitpos, contain a sign bit due to sign-extension). */ unsigned int padding = byte_size - ROUND_UP (bitlen, BITS_PER_UNIT) / BITS_PER_UNIT - 1; - if (padding != 0) + if (padding != 0 + || bitlen % BITS_PER_UNIT != 0) { /* On big-endian the padding is at the 'front' so just skip the initial bytes. */ -- 2.30.2