aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2016-02-10 22:40:41 (GMT)
committerCaroline Tice <cmtice@google.com>2016-02-26 16:25:55 (GMT)
commit817a788f9eb01eff367191401d48f2aaa8d4f428 (patch)
tree637f745404b37fbf3fcff629227d7d542725e5fe /gcc-4.9/gcc/testsuite/gcc.dg
parenta4ca82cac69c3147143d7b4b4d7cdeb5e02f20ef (diff)
downloadtoolchain_gcc-817a788f9eb01eff367191401d48f2aaa8d4f428.zip
toolchain_gcc-817a788f9eb01eff367191401d48f2aaa8d4f428.tar.gz
toolchain_gcc-817a788f9eb01eff367191401d48f2aaa8d4f428.tar.bz2
Unify ChromeOS and Android versions of GCC.
This CL updates Android's GCC to match ChromeOS's GCC (with appropriate patches applied in both places to make sure no cherry-picked changes are lost). Change-Id: I390140c449b0e5df9ee78a06268319c8c510302f
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/sancov/asan.c18
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic0.c9
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic1.c12
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic2.c14
4 files changed, 53 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/sancov/asan.c b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/asan.c
new file mode 100644
index 0000000..64a36b5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/asan.c
@@ -0,0 +1,18 @@
+/* Test coverage/asan interaction:
+ - coverage instruments __asan_init ctor (thus 4 covarage callbacks)
+ - coverage does not instrument asan-emitted basic blocks
+ - asan considers coverage callback as "nonfreeing" (thus 1 asan store
+ callback. */
+/* { dg-do compile { target fsanitize_address } } */
+/* { dg-options "-fsanitize-coverage=trace-pc -fsanitize=address -fdump-tree-optimized" } */
+
+void foo(volatile int *a, int *b)
+{
+ *a = 1;
+ if (*b)
+ *a = 2;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 4 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4 \\(" 1 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store4 \\(" 1 "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic0.c b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic0.c
new file mode 100644
index 0000000..af69b2d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic0.c
@@ -0,0 +1,9 @@
+/* Basic test on number of inserted callbacks. */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize-coverage=trace-pc -fdump-tree-optimized" } */
+
+void foo(void)
+{
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 1 "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic1.c b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic1.c
new file mode 100644
index 0000000..e0ae5b4
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic1.c
@@ -0,0 +1,12 @@
+/* Basic test on number of inserted callbacks. */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize-coverage=trace-pc -fdump-tree-optimized" } */
+
+void foo (int *a, int *b, int *c)
+{
+ *a = 1;
+ if (*b)
+ *c = 2;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 3 "optimized" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic2.c b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic2.c
new file mode 100644
index 0000000..ac2ec78
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/sancov/basic2.c
@@ -0,0 +1,14 @@
+/* Basic test on number of inserted callbacks. */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize-coverage=trace-pc -fdump-tree-optimized" } */
+
+void foo(int *a, int *b, int *c, int *d)
+{
+ *a = 1;
+ if (*b)
+ *c = 2;
+ else
+ *d = 3;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin___sanitizer_cov_trace_pc \\(\\)" 4 "optimized" } } */