On Tue, Nov 1, 2016 at 12:54 PM, Kyrill Tkachov <kyrylo.tkac...@foss.arm.com> wrote: > Hi all, > > In this PR the code writes a -1 to a bitfield of size 17 bits and ends up > overwriting another bitfields. > The problem is that the intermediate buffer in encode_tree_to_bitpos holding > the value to merge holds > a 24-bit temporary with -1 written to it i.e. sign-extended to all ones. > That is how native_encode_expr works.This gets then written to > the final buffer (well, a shifted version of it). > > We should instead be truncating the intermediate value to contain zeros in > all the bits that we don't want. > This is already performed for big-endian, this patch just wires it up for > little-endian. > > Bootstrapped and tested on x86_64. > Ok for trunk?
Ok. Richard. > Thanks, > Kyrill > > 2016-11-01 Kyrylo Tkachov <kyrylo.tkac...@arm.com> > > PR tree-optimization/78170 > * gimple-ssa-store-merging.c (encode_tree_to_bitpos): Truncate padding > introduced by native_encode_expr on little-endian as well. > > 2016-11-01 Kyrylo Tkachov <kyrylo.tkac...@arm.com> > > PR tree-optimization/78170 > * gcc.c-torture/execute/pr78170.c: New test.