aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.misc-tests/gcov-11.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.misc-tests/gcov-11.c')
-rw-r--r--gcc/testsuite/gcc.misc-tests/gcov-11.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-11.c b/gcc/testsuite/gcc.misc-tests/gcov-11.c
new file mode 100644
index 00000000000..a1037a552a9
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/gcov-11.c
@@ -0,0 +1,23 @@
+/* Test gcov block mode. */
+
+/* { dg-options "-fprofile-arcs -ftest-coverage" } */
+/* { dg-do run { target native } } */
+
+int one = 1; /* subvert constant folder. */
+int zero = 0;
+
+int foo (int ix)
+{
+ return ix & 1 ? one : zero; /* count(10) */
+}
+
+int main ()
+{
+ unsigned ix, jx = 0;
+
+ for (ix = 10; ix--;) jx += foo (ix); /* count(11) */
+
+ return jx != 5;
+}
+
+/* { dg-final { run-gcov { -a gcov-11.c } } } */