+2016-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/71512
+ * ubsan.c (instrument_si_overflow): Pass true instead of false
+ to gsi_replace.
+ (pass_ubsan::execute): Call gimple_purge_dead_eh_edges at the end
+ of bbs. Return TODO_cleanup_cfg if any returned true.
+
2016-08-12 Michael Meissner <meissner@linux.vnet.ibm.com>
* config/rs6000/vsx.md (vsx_concat_<mode>): Add support for the
+2016-08-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/71512
+ * g++.dg/ubsan/pr71512.C: New test.
+ * c-c++-common/ubsan/pr71512-1.c: New test.
+ * c-c++-common/ubsan/pr71512-2.c: New test.
+
2016-08-12 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/vec-init-1.c: New tests to test various
--- /dev/null
+/* PR c/71512 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftrapv -fnon-call-exceptions -fsanitize=undefined" } */
+
+bool
+foo (int *x, int *y, int *z)
+{
+ try
+ {
+ x[0] = y[0] + z[0];
+ x[1] = y[1] - z[1];
+ x[2] = y[2] * z[2];
+ x[3] = -y[3];
+ }
+ catch (...)
+ {
+ return true;
+ }
+ return false;
+}
? IFN_UBSAN_CHECK_SUB
: IFN_UBSAN_CHECK_MUL, 2, a, b);
gimple_call_set_lhs (g, lhs);
- gsi_replace (&gsi, g, false);
+ gsi_replace (&gsi, g, true);
break;
case NEGATE_EXPR:
/* Represent i = -u;
b = gimple_assign_rhs1 (stmt);
g = gimple_build_call_internal (IFN_UBSAN_CHECK_SUB, 2, a, b);
gimple_call_set_lhs (g, lhs);
- gsi_replace (&gsi, g, false);
+ gsi_replace (&gsi, g, true);
break;
case ABS_EXPR:
/* Transform i = ABS_EXPR<u>;
{
basic_block bb;
gimple_stmt_iterator gsi;
+ unsigned int ret = 0;
initialize_sanitizer_builtins ();
gsi_next (&gsi);
}
+ if (gimple_purge_dead_eh_edges (bb))
+ ret = TODO_cleanup_cfg;
}
- return 0;
+ return ret;
}
} // anon namespace