From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.dg/tree-ssa/pr36908.c | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr36908.c (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr36908.c') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c b/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c new file mode 100644 index 000000000..8fa2ed2ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr36908.c @@ -0,0 +1,65 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribution" } */ +#define NULL ((void *)0) + +__extension__ typedef __SIZE_TYPE__ size_t; +extern void *foo(size_t nelem, size_t elsize); +extern void bar (char*, ...); + +typedef struct alt_state *alt_state_t; +typedef struct state *state_t; + +struct alt_state +{ + alt_state_t next_alt_state; +}; + +static alt_state_t first_free_alt_state = NULL; + +static void +free_alt_state (alt_state_t alt_state) +{ + if (alt_state == NULL) + return; + alt_state->next_alt_state = first_free_alt_state; + first_free_alt_state = alt_state; +} + +/* The function frees list started with node ALT_STATE_LIST. */ +static void +free_alt_states (alt_state_t alt_states_list) +{ + alt_state_t curr_alt_state; + alt_state_t next_alt_state; + + for (curr_alt_state = alt_states_list; + curr_alt_state != NULL; + curr_alt_state = next_alt_state) + { + next_alt_state = curr_alt_state->next_alt_state; + free_alt_state (curr_alt_state); + } +} + +int +main (void) +{ + int i; + alt_state_t state, act_state; + + act_state = state = foo (1, sizeof (struct alt_state)); + for (i = 0; i < 2; i ++) + { + act_state->next_alt_state = foo (1, sizeof (struct alt_state)); + act_state = act_state->next_alt_state; + } + + free_alt_states (state); + + for (act_state = first_free_alt_state; + act_state != NULL; + act_state = act_state->next_alt_state) + bar ("going from %p to %p\n", act_state, act_state->next_alt_state); + + return 0; +} -- cgit v1.2.3