https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101278
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Component|c++ |tree-optimization Status|NEW |ASSIGNED Keywords| |wrong-code --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- There's a single deleted call LHS for the whole compilation: ;; Function cmCatViews_ (_ZL11cmCatViews_St16initializer_listIPKcE, funcdef_no=2127, decl_uid=467 17, cgraph_uid=266, symbol_order=284) + Deleted trivially dead stmt: p_35 = *__for_begin_3; + + Deleted dead store in call LHS: sit = std::copy_n<const char*, long unsigned int, __gnu_cxx::__normal_iterator<char*, std::vector<char> > > (p_28, 1, sit); + struct vector cmCatViews_ (struct initializer_list views) { char * SR.75; @@ -1238,7 +1245,6 @@ goto <bb 4>; [INV] <bb 3> : - p_35 = *__for_begin_3; total_size_36 = total_size_2 + 1; __for_begin_37 = __for_begin_3 + 8; @@ -1264,7 +1270,7 @@ <bb 7> : p_28 = *__for_begin_4; - sit = std::copy_n<const char*, long unsigned int, __gnu_cxx::__normal_iterator<char*, std::vector<char> > > (p_28, 1, sit); + std::copy_n<const char*, long unsigned int, __gnu_cxx::__normal_iterator<char*, std::vector<char> > > (p_28, 1, sit); __for_begin_30 = __for_begin_4 + 8; <bb 8> : # __for_begin_4 = PHI <views$_M_array_6(6), __for_begin_30(7)> if (__for_begin_4 != _19) goto <bb 7>; [INV] else goto <bb 9>; [INV] so it seems we fail to consider the lhs used by the call itself.