gimple *g = gimple_build_assign (make_ssa_name (TREE_TYPE (base)), base);
gimple_set_location (g, loc);
if (before_p)
- gsi_insert_before (iter, g, GSI_SAME_STMT);
+ gsi_safe_insert_before (iter, g);
else
gsi_insert_after (iter, g, GSI_NEW_STMT);
return gimple_assign_lhs (g);
NOP_EXPR, len);
gimple_set_location (g, loc);
if (before_p)
- gsi_insert_before (iter, g, GSI_SAME_STMT);
+ gsi_safe_insert_before (iter, g);
else
gsi_insert_after (iter, g, GSI_NEW_STMT);
return gimple_assign_lhs (g);
align / BITS_PER_UNIT));
gimple_set_location (g, loc);
if (before_p)
- gsi_insert_before (&gsi, g, GSI_SAME_STMT);
+ gsi_safe_insert_before (&gsi, g);
else
{
gsi_insert_after (&gsi, g, GSI_NEW_STMT);
tree decl = builtin_decl_implicit (BUILT_IN_ASAN_HANDLE_NO_RETURN);
gimple *g = gimple_build_call (decl, 0);
gimple_set_location (g, gimple_location (stmt));
- gsi_insert_before (iter, g, GSI_SAME_STMT);
+ gsi_safe_insert_before (iter, g);
}
}
g = gimple_build_assign (make_ssa_name (pointer_sized_int_node),
NOP_EXPR, len);
gimple_set_location (g, loc);
- gsi_insert_before (iter, g, GSI_SAME_STMT);
+ gsi_safe_insert_before (iter, g);
tree sz_arg = gimple_assign_lhs (g);
tree fun
--- /dev/null
+/* PR sanitizer/112709 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=address -O2" } */
+
+struct S { char c[1024]; } *p;
+int foo (int);
+
+__attribute__((returns_twice, noipa)) int
+bar (struct S x)
+{
+ (void) x.c[0];
+ return 0;
+}
+
+void
+baz (int *y)
+{
+ foo (1);
+ *y = bar (*p);
+}
+
+void
+qux (int x, int *y)
+{
+ if (x == 25)
+ x = foo (2);
+ else if (x == 42)
+ x = foo (foo (3));
+ *y = bar (*p);
+}
+
+void
+corge (int x, int *y)
+{
+ void *q[] = { &&l1, &&l2, &&l3, &&l3 };
+ if (x == 25)
+ {
+ l1:
+ x = foo (2);
+ }
+ else if (x == 42)
+ {
+ l2:
+ x = foo (foo (3));
+ }
+l3:
+ *y = bar (*p);
+ if (x < 4)
+ goto *q[x & 3];
+}