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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.misc-tests/] [gcov-3.c] - Blame information for rev 690

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 690 jeremybenn
/* Test Gcov with computed gotos.
2
   This is the same as test gcc.c-torture/execute/980526-1.c */
3
 
4
/* { dg-options "-fprofile-arcs -ftest-coverage" } */
5
/* { dg-do run { target native } } */
6
 
7
extern void abort (void);
8
extern void exit (int);
9
 
10
int expect_do1 = 1, expect_do2 = 2;
11
 
12
static int doit(int x){
13
  __label__ lbl1;
14
  __label__ lbl2;
15
  static int jtab_init = 0;
16
  static void *jtab[2];
17
 
18
  if(!jtab_init) {
19
    jtab[0] = &&lbl1;
20
    jtab[1] = &&lbl2;
21
    jtab_init = 1;
22
  }
23
  goto *jtab[x];
24
lbl1:
25
  return 1;
26
lbl2:
27
  return 2;
28
}
29
 
30
static void do1(void) {
31
  if (doit(0) != expect_do1)
32
    abort ();
33
}
34
 
35
static void do2(void){
36
  if (doit(1) != expect_do2)
37
    abort ();
38
}
39
 
40
int main(void){                 /* count(1) */
41
#ifndef NO_LABEL_VALUES
42
  do1();
43
  do2();
44
#endif
45
  exit(0);                       /* count(1) */
46
}
47
 
48
/* { dg-final { run-gcov gcov-3.c } } */

powered by: WebSVN 2.1.0

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