https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84503
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Thu Feb 22 08:28:42 2018 New Revision: 257891 URL: https://gcc.gnu.org/viewcvs?rev=257891&root=gcc&view=rev Log: PR tree-optimization/84503 * gimple-ssa-store-merging.c (merged_store_group::merge_into): Compute width as info->bitpos + info->bitsize - start. (merged_store_group::merge_overlapping): Simplify width computation. (check_no_overlap): New function. (imm_store_chain_info::try_coalesce_bswap): Compute expected start + width and last_order of the group, fail if check_no_overlap fails. (imm_store_chain_info::coalesce_immediate_stores): Don't merge info to group if check_no_overlap fails. * gcc.dg/pr84503-1.c: New test. * gcc.dg/pr84503-2.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr84503-1.c trunk/gcc/testsuite/gcc.dg/pr84503-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-store-merging.c trunk/gcc/testsuite/ChangeLog