OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.misc-tests/] [gcov-8.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Check that gcov correctly rounds nearly zero to nonzero and nearly
2
   100 to not-100.
3
 
4
   Copyright (C) 2002 Free Software Foundation, Inc.
5
   Contributed by Nathan Sidwell <nathan@codesourcery.com>
6
*/
7
 
8
/* { dg-options "-fprofile-arcs -ftest-coverage" } */
9
/* { dg-do run { target native } } */
10
 
11
int proxy (int i)
12
{
13
  return i;
14
}
15
 
16
int foo (int i)
17
{
18
  if (i > 0) /* branch(1) */
19
    return proxy (1);
20
  else if (i < 0) /* branch(100) */
21
    return proxy (-1);
22
  else
23
    return proxy (0);
24
}
25
 
26
int baz (int i)
27
{
28
  if (i == 0) /* branch(99) */
29
    return proxy (0);
30
  else if (i > 0) /* branch(0)*/
31
    return proxy (1);
32
  else
33
    return proxy (-1);
34
}
35
 
36
int main ()
37
{
38
  int t = 0;
39
  int ix;
40
 
41
  for (ix = 0; ix != 1000; ix++)
42
    t += foo (ix) + baz (ix);
43
 
44
  return t == 0;
45
}
46
 
47
/* { dg-final { run-gcov branches {-b gcov-8.c } } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.