struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-990128-1.c
blobb513a0d14a10e258d1fbad6497fc78d17cec465e
1 /*
2 990128-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 extern int printf (const char *,...);
13 struct s { struct s *n; } *p;
14 struct s ss;
15 #define MAX 10
16 struct s sss[MAX];
17 int count = 0;
19 void sub( struct s *p, struct s **pp );
20 int look( struct s *p, struct s **pp );
22 void
23 testTortureExecute (void)
25 struct s *pp;
26 struct s *next;
27 int i;
29 p = &ss;
30 next = p;
31 for ( i = 0; i < MAX; i++ ) {
32 next->n = &sss[i];
33 next = next->n;
35 next->n = 0;
37 sub( p, &pp );
38 if (count != MAX+2)
39 ASSERT ( 0 );
41 return;
44 void sub( struct s *p, struct s **pp )
46 for ( ; look( p, pp ); ) {
47 if ( p )
48 p = p->n;
49 else
50 break;
54 int look( struct s *p, struct s **pp )
56 for ( ; p; p = p->n )
58 *pp = p;
59 count++;
60 return( 1 );