From f87b4b2fbfb3f0cbfe120666718408442900ff19 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 19 Mar 2018 21:49:57 +0100 Subject: [PATCH] re PR tree-optimization/84946 (UBSAN: in mem_valid_for_store_merging ../../gcc/gimple-ssa-store-merging.c:3951) 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 | 4 ++++ gcc/gimple-ssa-store-merging.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9df89dcbca3..6742c0b68bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2018-03-19 Jakub Jelinek + 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 diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index 7b56031fd47..5955d6e1abc 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -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) -- 2.30.2