Corrected date in changelog
[official-gcc.git] / gcc / testsuite / gcc.misc-tests / gcov-3.c
blob5b07dd74bd1bb019cca698603b0dfec7bf37ffa9
1 /* { dg-do run { target native } } */
2 /* { dg-require-effective-target label_values } */
4 /* Test Gcov with computed gotos.
5 This is the same as test gcc.c-torture/execute/980526-1.c */
7 /* { dg-options "-fprofile-arcs -ftest-coverage" } */
9 extern void abort (void);
10 extern void exit (int);
12 int expect_do1 = 1, expect_do2 = 2;
14 static int doit(int x){
15 __label__ lbl1;
16 __label__ lbl2;
17 static int jtab_init = 0;
18 static void *jtab[2];
20 if(!jtab_init) {
21 jtab[0] = &&lbl1;
22 jtab[1] = &&lbl2;
23 jtab_init = 1;
25 goto *jtab[x];
26 lbl1:
27 return 1;
28 lbl2:
29 return 2;
32 static void do1(void) {
33 if (doit(0) != expect_do1)
34 abort ();
37 static void do2(void){
38 if (doit(1) != expect_do2)
39 abort ();
42 int main(void){ /* count(1) */
43 do1();
44 do2();
45 exit(0); /* count(1) */
48 /* { dg-final { run-gcov gcov-3.c } } */