2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 990128-1.c
blobcfdab3e87e5eb11a49950fe05c30b2115cf6b3f9
1 extern int printf (const char *,...);
3 struct s { struct s *n; } *p;
4 struct s ss;
5 #define MAX 10
6 struct s sss[MAX];
7 int count = 0;
9 void sub( struct s *p, struct s **pp );
10 int look( struct s *p, struct s **pp );
12 main()
14 struct s *pp;
15 struct s *next;
16 int i;
18 p = &ss;
19 next = p;
20 for ( i = 0; i < MAX; i++ ) {
21 next->n = &sss[i];
22 next = next->n;
24 next->n = 0;
26 sub( p, &pp );
27 if (count != MAX+2)
28 abort ();
30 exit( 0 );
33 void sub( struct s *p, struct s **pp )
35 for ( ; look( p, pp ); ) {
36 if ( p )
37 p = p->n;
38 else
39 break;
43 int look( struct s *p, struct s **pp )
45 for ( ; p; p = p->n )
47 *pp = p;
48 count++;
49 return( 1 );