PR fortran/77973
[official-gcc.git] / gcc / testsuite / gcc.misc-tests / bprob-2.c
blobe0931f39c469e9709b4782d9f899cda6141827ff
1 /* Test profile-directed block ordering with computed gotos.
3 This is the same as test gcc.c-torture/execute/980526-1.c and
4 gcc.misc-tests/gcov-3.c */
6 extern void abort (void);
7 extern void exit (int);
9 int expect_do1 = 1, expect_do2 = 2;
11 static int doit(int x){
12 __label__ lbl1;
13 __label__ lbl2;
14 static int jtab_init = 0;
15 static void *jtab[2];
17 if(!jtab_init) {
18 jtab[0] = &&lbl1;
19 jtab[1] = &&lbl2;
20 jtab_init = 1;
22 goto *jtab[x];
23 lbl1:
24 return 1;
25 lbl2:
26 return 2;
29 static void do1(void) {
30 if (doit(0) != expect_do1)
31 abort ();
34 static void do2(void){
35 if (doit(1) != expect_do2)
36 abort ();
39 int main(void){
40 #ifndef NO_LABEL_VALUES
41 do1();
42 do2();
43 #endif
44 exit(0);