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.c-torture/] [execute/] [990128-1.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
extern int printf (const char *,...);
2
 
3
struct s { struct s *n; } *p;
4
struct s ss;
5
#define MAX     10
6
struct s sss[MAX];
7
int count = 0;
8
 
9
void sub( struct s *p, struct s **pp );
10
int look( struct s *p, struct s **pp );
11
 
12
main()
13
{
14
    struct s *pp;
15
    struct s *next;
16
    int i;
17
 
18
    p = &ss;
19
    next = p;
20
    for ( i = 0; i < MAX; i++ ) {
21
        next->n = &sss[i];
22
        next = next->n;
23
    }
24
    next->n = 0;
25
 
26
    sub( p, &pp );
27
    if (count != MAX+2)
28
      abort ();
29
 
30
    exit( 0 );
31
}
32
 
33
void sub( struct s *p, struct s **pp )
34
{
35
   for ( ; look( p, pp ); ) {
36
        if ( p )
37
            p = p->n;
38
        else
39
            break;
40
   }
41
}
42
 
43
int look( struct s *p, struct s **pp )
44
{
45
    for ( ; p; p = p->n )
46
        ;
47
    *pp = p;
48
    count++;
49
    return( 1 );
50
}

powered by: WebSVN 2.1.0

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