diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index b4c5e8eb9a8..213c1551d39 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -5230,7 +5230,7 @@ pass_store_merging::process_store (gimple *stmt) if (idx >= (unsigned)param_max_store_chains_to_track || (n_stores + (*e)->m_store_info.length () > (unsigned)param_max_stores_to_track)) - terminate_and_process_chain (*e); + ret |= terminate_and_process_chain (*e); else { n_stores += (*e)->m_store_info.length (); diff --git a/gcc/testsuite/g++.dg/pr99165.C b/gcc/testsuite/g++.dg/pr99165.C new file mode 100644 index 00000000000..70ffd0345cf --- /dev/null +++ b/gcc/testsuite/g++.dg/pr99165.C @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-O2 -fnon-call-exceptions --param=max-stores-to-track=2" } + +struct A { + A() : i() {} + int i; +} *ap2 = new A[3];