re PR tree-optimization/84946 (UBSAN: in mem_valid_for_store_merging ../../gcc/gimple...
authorJakub Jelinek <jakub@redhat.com>
Mon, 19 Mar 2018 20:49:57 +0000 (21:49 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 19 Mar 2018 20:49:57 +0000 (21:49 +0100)
PR tree-optimization/84946
* gimple-ssa-store-merging.c (mem_valid_for_store_merging): Compute
bitsize + bitsize in poly_uint64 rather than poly_int64.

From-SVN: r258665

gcc/ChangeLog
gcc/gimple-ssa-store-merging.c

index 9df89dcbca37647d0f6268d5fcffaeb15b821374..6742c0b68bc5e70f8e6cb44050af44a4bc54504a 100644 (file)
@@ -1,5 +1,9 @@
 2018-03-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/84946
+       * gimple-ssa-store-merging.c (mem_valid_for_store_merging): Compute
+       bitsize + bitsize in poly_uint64 rather than poly_int64.
+
        PR sanitizer/78651
        * dwarf2asm.c: Include fold-const.c.
        (dw2_output_indirect_constant_1): Set DECL_INITIAL (decl) to ADDR_EXPR
index 7b56031fd4790e8e68581d87b83e1c4aaa627a04..5955d6e1abc0efe449955d138677a387e153ff53 100644 (file)
@@ -3948,7 +3948,8 @@ mem_valid_for_store_merging (tree mem, poly_uint64 *pbitsize,
   if (known_eq (bitregion_end, 0U))
     {
       bitregion_start = round_down_to_byte_boundary (bitpos);
-      bitregion_end = round_up_to_byte_boundary (bitpos + bitsize);
+      bitregion_end = bitpos;
+      bitregion_end = round_up_to_byte_boundary (bitregion_end + bitsize);
     }
 
   if (offset != NULL_TREE)