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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr40022.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
extern void abort (void);
2
 
3
struct A
4
{
5
  struct A *a;
6
};
7
 
8
struct B
9
{
10
  struct A *b;
11
};
12
 
13
__attribute__((noinline))
14
struct A *
15
foo (struct A *x)
16
{
17
  asm volatile ("" : : "g" (x) : "memory");
18
  return x;
19
}
20
 
21
__attribute__((noinline))
22
void
23
bar (struct B *w, struct A *x, struct A *y, struct A *z)
24
{
25
  struct A **c;
26
  c = &w->b;
27
  *c = foo (x);
28
  while (*c)
29
    c = &(*c)->a;
30
  *c = foo (y);
31
  while (*c)
32
    c = &(*c)->a;
33
  *c = foo (z);
34
}
35
 
36
struct B d;
37
struct A e, f, g;
38
 
39
int
40
main (void)
41
{
42
  f.a = &g;
43
  bar (&d, &e, &f, 0);
44
  if (d.b == 0
45
      || d.b->a == 0
46
      || d.b->a->a == 0
47
      || d.b->a->a->a != 0)
48
    abort ();
49
  return 0;
50
}
51
 

powered by: WebSVN 2.1.0

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