FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / gcc.misc-tests / bprob-2.c
blob4615b34f4ff10270106e0ac38b6ddfe979ba9d5d
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 int expect_do1 = 1, expect_do2 = 2;
8 static int doit(int x){
9 __label__ lbl1;
10 __label__ lbl2;
11 static int jtab_init = 0;
12 static void *jtab[2];
14 if(!jtab_init) {
15 jtab[0] = &&lbl1;
16 jtab[1] = &&lbl2;
17 jtab_init = 1;
19 goto *jtab[x];
20 lbl1:
21 return 1;
22 lbl2:
23 return 2;
26 static void do1(void) {
27 if (doit(0) != expect_do1)
28 abort ();
31 static void do2(void){
32 if (doit(1) != expect_do2)
33 abort ();
36 int main(void){
37 #ifndef NO_LABEL_VALUES
38 do1();
39 do2();
40 #endif
41 exit(0);