1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-loop-distribution" } */
3 #define NULL ((void *)0)
5 typedef unsigned int size_t;
6 extern void *foo(size_t nelem, size_t elsize);
7 extern void bar (char*, ...);
9 typedef struct alt_state *alt_state_t;
10 typedef struct state *state_t;
14 alt_state_t next_alt_state;
17 static alt_state_t first_free_alt_state = NULL;
20 free_alt_state (alt_state_t alt_state)
22 if (alt_state == NULL)
24 alt_state->next_alt_state = first_free_alt_state;
25 first_free_alt_state = alt_state;
28 /* The function frees list started with node ALT_STATE_LIST. */
30 free_alt_states (alt_state_t alt_states_list)
32 alt_state_t curr_alt_state;
33 alt_state_t next_alt_state;
35 for (curr_alt_state = alt_states_list;
36 curr_alt_state != NULL;
37 curr_alt_state = next_alt_state)
39 next_alt_state = curr_alt_state->next_alt_state;
40 free_alt_state (curr_alt_state);
48 alt_state_t state, act_state;
50 act_state = state = foo (1, sizeof (struct alt_state));
51 for (i = 0; i < 2; i ++)
53 act_state->next_alt_state = foo (1, sizeof (struct alt_state));
54 act_state = act_state->next_alt_state;
57 free_alt_states (state);
59 for (act_state = first_free_alt_state;
61 act_state = act_state->next_alt_state)
62 bar ("going from %p to %p\n", act_state, act_state->next_alt_state);