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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20030717-1.c] - Blame information for rev 297

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

Line No. Rev Author Line
1 297 jeremybenn
/* PR target/11087
2
   This testcase was miscompiled on ppc64, because basic_induction_var called
3
   convert_modes, yet did not expect it to emit any new instructions.
4
   Those were emitted at the end of the function and destroyed during life
5
   analysis, while the program used uninitialized pseudos created by
6
   convert_modes.  */
7
 
8
struct A
9
{
10
  unsigned short a1;
11
  unsigned long a2;
12
};
13
 
14
struct B
15
{
16
  int b1, b2, b3, b4, b5;
17
};
18
 
19
struct C
20
{
21
  struct B c1[1];
22
  int c2, c3;
23
};
24
 
25
static
26
int foo (int x)
27
{
28
  return  x < 0 ? -x : x;
29
}
30
 
31
int bar (struct C *x, struct A *y)
32
{
33
  int a = x->c3;
34
  const int b = y->a1 >> 9;
35
  const unsigned long c = y->a2;
36
  int d = a;
37
  unsigned long e, f;
38
 
39
  f = foo (c - x->c1[d].b4);
40
  do
41
    {
42
      if (d <= 0)
43
        d = x->c2;
44
      d--;
45
 
46
      e = foo (c-x->c1[d].b4);
47
      if (e < f)
48
        a = d;
49
    }
50
  while (d != x->c3);
51
  x->c1[a].b4 = c + b;
52
  return a;
53
}
54
 
55
int
56
main ()
57
{
58
  struct A a;
59
  struct C b;
60
  int c;
61
 
62
  a.a1 = 512;
63
  a.a2 = 4242;
64
  __builtin_memset (&b, 0, sizeof (b));
65
  b.c1[0].b3 = 424242;
66
  b.c2 = 1;
67
  c = bar (&b, &a);
68
  return 0;
69
}

powered by: WebSVN 2.1.0

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