Do not put gimple stmt on an abnormal edge (PR sanitizer/82545).
authorMartin Liska <mliska@suse.cz>
Wed, 18 Oct 2017 08:14:47 +0000 (10:14 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 18 Oct 2017 08:14:47 +0000 (08:14 +0000)
2017-10-18  Martin Liska  <mliska@suse.cz>

PR sanitizer/82545
* asan.c (asan_expand_poison_ifn): Do not put gimple stmt
on an abnormal edge.
2017-10-18  Martin Liska  <mliska@suse.cz>

PR sanitizer/82545
* gcc.dg/asan/pr82545.c: New test.

From-SVN: r253845

gcc/ChangeLog
gcc/asan.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/asan/pr82545.c [new file with mode: 0644]

index a59161d9b544aecafc212e0cfeab6a3870d7948a..b945f8bc643599532ade7fda33d3d3e2ef5f7baa 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-18  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/82545
+       * asan.c (asan_expand_poison_ifn): Do not put gimple stmt
+       on an abnormal edge.
+
 2017-10-18  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
        * doc/invoke.texi (ffunction-sections and fdata-sections):
index 2aa0a795af2016140b9fb743ea66c8f29f60556c..99958ecc330e751c38d56bbc2ad6e2448be986f4 100644 (file)
@@ -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);
 
index f0f3e738a53e034717aec49af4a8e9fbabfcaa5a..4ac7524bbec18a2afb9b08157e8ccc736e6f6975 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-18  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/82545
+       * gcc.dg/asan/pr82545.c: New test.
+
 2017-10-18  Paolo Carlini  <paolo.carlini@oracle.com>
 
        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 (file)
index 0000000..8870db3
--- /dev/null
@@ -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();
+}