OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [pr36908.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2 -ftree-loop-distribution" } */
3
#define NULL ((void *)0)
4
 
5
__extension__ typedef __SIZE_TYPE__ size_t;
6
extern void *foo(size_t nelem, size_t elsize);
7
extern void bar (char*, ...);
8
 
9
typedef struct alt_state *alt_state_t;
10
typedef struct state *state_t;
11
 
12
struct alt_state
13
{
14
  alt_state_t next_alt_state;
15
};
16
 
17
static alt_state_t first_free_alt_state = NULL;
18
 
19
static void
20
free_alt_state (alt_state_t alt_state)
21
{
22
  if (alt_state == NULL)
23
    return;
24
  alt_state->next_alt_state = first_free_alt_state;
25
  first_free_alt_state = alt_state;
26
}
27
 
28
/* The function frees list started with node ALT_STATE_LIST.  */
29
static void
30
free_alt_states (alt_state_t alt_states_list)
31
{
32
  alt_state_t curr_alt_state;
33
  alt_state_t next_alt_state;
34
 
35
  for (curr_alt_state = alt_states_list;
36
       curr_alt_state != NULL;
37
       curr_alt_state = next_alt_state)
38
    {
39
      next_alt_state = curr_alt_state->next_alt_state;
40
      free_alt_state (curr_alt_state);
41
    }
42
}
43
 
44
int
45
main (void)
46
{
47
  int i;
48
  alt_state_t state, act_state;
49
 
50
  act_state = state = foo (1, sizeof (struct alt_state));
51
  for (i = 0; i < 2; i ++)
52
  {
53
    act_state->next_alt_state = foo (1, sizeof (struct alt_state));
54
    act_state = act_state->next_alt_state;
55
  }
56
 
57
  free_alt_states (state);
58
 
59
  for (act_state = first_free_alt_state;
60
       act_state != NULL;
61
       act_state = act_state->next_alt_state)
62
       bar ("going from %p to %p\n", act_state, act_state->next_alt_state);
63
 
64
  return 0;
65
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.