Fix for big-endian gcc.c-torture/execute/pr55750.c
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Wed, 2 Nov 2016 16:03:13 +0000 (16:03 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Wed, 2 Nov 2016 16:03:13 +0000 (16:03 +0000)
* 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
gcc/gimple-ssa-store-merging.c

index 241ff78d55593e15f375a4ef4157318a07056400..96bcf4110f6a75a086d369ceb37eca5fd7de30f0 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-02  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       * 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  <rguenther@suse.de>
 
        * gimple-ssa-store-merging.c: Include gimplify-me.h.
index 1bca4a137583dc0a66cec4196bbcfb646cae30dd..36bc833af910f85c4c8ed7581a247f5d3182053d 100644 (file)
@@ -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.  */