3 int foo (struct st1
*p
);
4 int bar (struct st1
*p
);
6 void test_1 (struct st1
*p
)
8 test_1 (p
); /* { dg-warning "infinite recursion" } */
11 void test_2_if (struct st1
*p
)
14 test_2_if (p
); /* { dg-bogus "infinite recursion" } */
17 void test_2_switch (struct st1
*p
)
22 test_2_switch (p
); /* { dg-bogus "infinite recursion" } */
29 void test_2_if_compound (struct st1
*p
)
31 if ((foo (p
) + bar (p
)) >= 0)
32 test_2_if_compound (p
); /* { dg-bogus "infinite recursion" } */
35 void test_3 (struct st1
*p
)
38 test_3 (p
); /* { dg-warning "infinite recursion" } */
39 /* The content of *p never affects control flow, so we should
48 void test_4 (struct st2
*p
)
51 test_4 (p
); /* { dg-warning "infinite recursion" } */
54 void test_5 (struct st2
*p
)
57 test_5 (p
); /* { dg-bogus "infinite recursion" } */
60 /* Mixtures of heap allocation and recursion. It's not clear what we
61 should do for such cases, but make sure we don't ICE. */
63 void test_6 (struct st2
*p
)
65 struct st2
*q
= (struct st2
*) __builtin_malloc (p
->i
);
73 void test_7 (struct st2
*p
)
75 struct st2
*q
= (struct st2
*) __builtin_malloc (p
->i
);
76 q
->i
= p
->i
; /* { dg-warning "dereference of possibly-NULL 'q'" } */
81 void test_switch_1 (int i
)
96 test_switch_1 (j
); /* { dg-warning "infinite recursion" "" { xfail *-*-* } } */
99 void test_switch_2 (int i
)
104 test_switch_2 (1066);
107 test_switch_2 (1776);
110 test_switch_2 (1492); /* { dg-warning "infinite recursion" "" { xfail *-*-* } } */