diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-05 22:16:51 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-05 22:16:51 +0000 |
commit | 21ff9ee870f32e8617ee1918381b64d0ffa82222 (patch) | |
tree | 14ce17895d333e555a6871437542358a5ed0beac /gcc/testsuite/gcc.misc-tests | |
parent | 5a3fb4d355d4a39e8b85606aa7e7453121936225 (diff) | |
download | gcc-21ff9ee870f32e8617ee1918381b64d0ffa82222.tar.gz |
gcc:
* gcov.c (output_data): Round to % to nearest, tweak formatting.
testsuite:
* lib/gcov.exp: Tweak expected line formats.
* gcc.misc-tests/gcov8.c: New test.
* gcc.misc-tests/gcov8.x: New flags.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56059 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.misc-tests')
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/gcov-8.c | 47 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/gcov-8.x | 2 |
2 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/gcov-8.c b/gcc/testsuite/gcc.misc-tests/gcov-8.c new file mode 100644 index 00000000000..58eec645558 --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/gcov-8.c @@ -0,0 +1,47 @@ +/* Check that gcov correctly rounds nearly zero to non-zero and nearly + 100 to not-100. + + Copyright (C) 2002 Free Software Foundation, Inc. + Contributed by Nathan Sidwell <nathan@codesourcery.com> +*/ + +/* { dg-options "-fprofile-arcs -ftest-coverage" } */ +/* { dg-do run { target native } } */ + +int proxy (int i) +{ + return i; +} + +int foo (int i) +{ + if (i > 0) /* branch(1) */ + return proxy (1); + else if (i < 0) /* branch(100) */ + return proxy (-1); + else + return proxy (0); +} + +int baz (int i) +{ + if (i == 0) /* branch(99) */ + return proxy (0); + else if (i > 0) /* branch(0)*/ + return proxy (1); + else + return proxy (-1); +} + +int main () +{ + int t = 0; + int ix; + + for (ix = 0; ix != 1000; ix++) + t += foo (ix) + baz (ix); + + return t == 0; +} + +/* { dg-final { run-gcov -b gcov-8.c } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-8.x b/gcc/testsuite/gcc.misc-tests/gcov-8.x new file mode 100644 index 00000000000..b01ef42b9d7 --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/gcov-8.x @@ -0,0 +1,2 @@ +set gcov_verify_branches 1 +return 0 |