From 236ac44204c4a0f172751fad3221a8686e58bfc7 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 18 Oct 2017 10:14:47 +0200 Subject: [PATCH] Do not put gimple stmt on an abnormal edge (PR sanitizer/82545). 2017-10-18 Martin Liska PR sanitizer/82545 * asan.c (asan_expand_poison_ifn): Do not put gimple stmt on an abnormal edge. 2017-10-18 Martin Liska PR sanitizer/82545 * gcc.dg/asan/pr82545.c: New test. From-SVN: r253845 --- gcc/ChangeLog | 6 ++++++ gcc/asan.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asan/pr82545.c | 17 +++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/asan/pr82545.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a59161d9b54..b945f8bc643 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-18 Martin Liska + + PR sanitizer/82545 + * asan.c (asan_expand_poison_ifn): Do not put gimple stmt + on an abnormal edge. + 2017-10-18 Sebastian Huber * doc/invoke.texi (ffunction-sections and fdata-sections): diff --git a/gcc/asan.c b/gcc/asan.c index 2aa0a795af2..99958ecc330 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -3400,6 +3400,10 @@ asan_expand_poison_ifn (gimple_stmt_iterator *iter, { edge e = gimple_phi_arg_edge (phi, i); + /* Do not insert on an edge we can't split. */ + if (e->flags & EDGE_ABNORMAL) + continue; + if (call_to_insert == NULL) call_to_insert = gimple_copy (call); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f0f3e738a53..4ac7524bbec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-18 Martin Liska + + PR sanitizer/82545 + * gcc.dg/asan/pr82545.c: New test. + 2017-10-18 Paolo Carlini PR c++/69057 diff --git a/gcc/testsuite/gcc.dg/asan/pr82545.c b/gcc/testsuite/gcc.dg/asan/pr82545.c new file mode 100644 index 00000000000..8870db3653f --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr82545.c @@ -0,0 +1,17 @@ +/* PR sanitizer/82545. */ +/* { dg-do compile } */ + +extern void c(int); +extern void d(void); + +void *buf[5]; + +void a(void) { + { + int b; + &b; + __builtin_setjmp(buf); + c(b); + } + d(); +} -- 2.30.2