aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-store-merging.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2020-04-23 22:25:04 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2020-04-23 22:28:02 +0200
commitcb76fcd7fb4a4f1e4d1688deca87969124f16fef (patch)
treee88afac8754c40f70acbb0ebce17d70724c25505 /gcc/gimple-ssa-store-merging.c
parent431ee3581584c533acc77ab840d9ad71f45b9831 (diff)
downloadgcc-cb76fcd7fb4a4f1e4d1688deca87969124f16fef.zip
gcc-cb76fcd7fb4a4f1e4d1688deca87969124f16fef.tar.gz
gcc-cb76fcd7fb4a4f1e4d1688deca87969124f16fef.tar.bz2
Fix segfault with -O2 -fnon-call-exceptions -ftracer
The GIMPLE SSA store merging pass blows up when it is rewriting the stores because it didn't realize that they don't belong to the same EH region. Fixed by refusing to merge them. PR tree-optimization/94717 * gimple-ssa-store-merging.c (try_coalesce_bswap): Return false if one of the stores doesn't have the same landing pad number as the first. (coalesce_immediate_stores): Do not try to coalesce the store using bswap if it doesn't have the same landing pad number as the first.
Diffstat (limited to 'gcc/gimple-ssa-store-merging.c')
-rw-r--r--gcc/gimple-ssa-store-merging.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c
index a6687cd..2575351 100644
--- a/gcc/gimple-ssa-store-merging.c
+++ b/gcc/gimple-ssa-store-merging.c
@@ -2435,6 +2435,7 @@ imm_store_chain_info::try_coalesce_bswap (merged_store_group *merged_store,
for (unsigned int i = first + 1; i < len; ++i)
{
if (m_store_info[i]->bitpos != m_store_info[first]->bitpos + width
+ || m_store_info[i]->lp_nr != merged_store->lp_nr
|| m_store_info[i]->ins_stmt == NULL)
return false;
width += m_store_info[i]->bitsize;
@@ -2682,6 +2683,7 @@ imm_store_chain_info::coalesce_immediate_stores ()
if (info->bitpos == merged_store->start + merged_store->width
&& merged_store->stores.length () == 1
&& merged_store->stores[0]->ins_stmt != NULL
+ && info->lp_nr == merged_store->lp_nr
&& info->ins_stmt != NULL)
{
unsigned int try_size;