if (ptrofftype_p (len))
return len;
gimple *g = gimple_build_assign (make_ssa_name (pointer_sized_int_node),
- NOP_EXPR, len);
+ NOP_EXPR, len);
gimple_set_location (g, loc);
if (before_p)
gsi_safe_insert_before (iter, g);
bool is_non_zero_len, bool before_p, bool is_store,
bool is_scalar_access, unsigned int align = 0)
{
- gimple_stmt_iterator gsi = *iter;
gimple *g;
gcc_assert (!(size_in_bytes > 0 && !is_non_zero_len));
gcc_assert (size_in_bytes == -1 || size_in_bytes >= 1);
- gsi = *iter;
-
base = unshare_expr (base);
- base = maybe_create_ssa_name (loc, base, &gsi, before_p);
+ base = maybe_create_ssa_name (loc, base, iter, before_p);
if (len)
{
align / BITS_PER_UNIT));
gimple_set_location (g, loc);
if (before_p)
- gsi_safe_insert_before (&gsi, g);
+ gsi_safe_insert_before (iter, g);
else
{
- gsi_insert_after (&gsi, g, GSI_NEW_STMT);
- gsi_next (&gsi);
- *iter = gsi;
+ gsi_insert_after (iter, g, GSI_NEW_STMT);
+ gsi_next (iter);
}
}
--- /dev/null
+/* PR sanitizer/117209 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=address" } */
+
+struct A { char a; };
+void foo (void);
+__attribute__((returns_twice, const)) int bar (struct A);
+
+void
+baz (struct A *x, int *y, int z)
+{
+ if (z)
+ foo ();
+ *y = bar (*x);
+}