--- /dev/null
+// { dg-do compile }
+// { dg-additional-options "-Wall" }
+
+#include <vector> // dg-bogus new_allocator.h:191 warning: writing 1 byte into a region of size 0
+
+void bar(std::vector<char>);
+
+void foo()
+{
+ std::vector<char> v{1, 2};
+ v.insert(v.end(), 2, 0);
+ v.push_back(1);
+ bar(v);
+}
#include "tree-into-ssa.h"
#include "builtins.h"
#include "case-cfn-macros.h"
+#include "tree-eh.h"
static tree analyze_scalar_evolution_1 (class loop *, tree);
static tree analyze_scalar_evolution_for_address_of (class loop *loop,
print_gimple_stmt (dump_file, SSA_NAME_DEF_STMT (rslt), 0);
fprintf (dump_file, "\n");
}
+
+ /* Re-fold immediate uses of the replaced def, but avoid
+ CFG manipulations from this function. For now only do
+ a single-level re-folding, not re-folding uses of
+ folded uses. */
+ if (! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rslt))
+ {
+ gimple *use_stmt;
+ imm_use_iterator imm_iter;
+ FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, rslt)
+ {
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ if (!stmt_can_throw_internal (cfun, use_stmt)
+ && fold_stmt (&gsi, follow_all_ssa_edges))
+ update_stmt (gsi_stmt (gsi));
+ }
+ }
}
return any;