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/] [pr39100.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 297 jeremybenn
/* Bad PTA results (incorrect store handling) was causing us to delete
2
   *na = 0 store.  */
3
 
4
typedef struct E
5
{
6
  int p;
7
  struct E *n;
8
} *EP;
9
 
10
typedef struct C
11
{
12
  EP x;
13
  short cn, cp;
14
} *CP;
15
 
16
__attribute__((noinline)) CP
17
foo (CP h, EP x)
18
{
19
  EP pl = 0, *pa = &pl;
20
  EP nl = 0, *na = &nl;
21
  EP n;
22
 
23
  while (x)
24
    {
25
      n = x->n;
26
      if ((x->p & 1) == 1)
27
        {
28
          h->cp++;
29
          *pa = x;
30
          pa = &((*pa)->n);
31
        }
32
      else
33
        {
34
          h->cn++;
35
          *na = x;
36
          na = &((*na)->n);
37
        }
38
      x = n;
39
    }
40
  *pa = nl;
41
  *na = 0;
42
  h->x = pl;
43
  return h;
44
}
45
 
46
int
47
main (void)
48
{
49
  struct C c = { 0, 0, 0 };
50
  struct E e[2] = { { 0, &e[1] }, { 1, 0 } };
51
  EP p;
52
 
53
  foo (&c, &e[0]);
54
  if (c.cn != 1 || c.cp != 1)
55
    __builtin_abort ();
56
  if (c.x != &e[1])
57
    __builtin_abort ();
58
  if (e[1].n != &e[0])
59
    __builtin_abort ();
60
  if (e[0].n)
61
    __builtin_abort ();
62
  return 0;
63
}
64
 
65
 

powered by: WebSVN 2.1.0

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