diff mbox

Fix for big-endian gcc.c-torture/execute/pr55750.c

Message ID 581A029A.6010401@foss.arm.com
State New
Headers show

Commit Message

Kyrill Tkachov Nov. 2, 2016, 3:13 p.m. UTC
Hi all,

I noticed that my patch for PR tree-optimization/78170 broke execute.exp=pr55750.c on big-endian.
The problem with that patch is that we should not forget to clear the padding bits in the temporary
buffer when merging values even when they are less than a byte.

Tested on aarch64_be-none-elf (the test failure goes away)
Bootstrap and test on x86_64 ongoing.
Ok for trunk if successful?

David, does this patch allow AIX bootstrap to proceed by any chance?

Thanks,
Kyrill

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.

Comments

Richard Biener Nov. 2, 2016, 3:19 p.m. UTC | #1
On Wed, 2 Nov 2016, Kyrill Tkachov wrote:

> Hi all,

> 

> I noticed that my patch for PR tree-optimization/78170 broke

> execute.exp=pr55750.c on big-endian.

> The problem with that patch is that we should not forget to clear the padding

> bits in the temporary

> buffer when merging values even when they are less than a byte.

> 

> Tested on aarch64_be-none-elf (the test failure goes away)

> Bootstrap and test on x86_64 ongoing.

> Ok for trunk if successful?


Ok.

Thanks,
Richard.

> David, does this patch allow AIX bootstrap to proceed by any chance?


Crossing fingers ;)

> Thanks,

> Kyrill

> 

> 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.

>
diff mbox

Patch

diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index 081620e50f603e2de8ed962aec6c619890ce1e33..db3c3c14a5b8938024db8bed80145c77d29396ac 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -430,7 +430,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.  */