aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/20021024-1.c
blob: f7d98e929a26fbdd1b819caa1c287193379355bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Origin: PR target/6981 from Mattias Engdegaard <mattias@virtutech.se>.  */

void exit (int);
void abort (void);

unsigned long long *cp, m;

void foo (void)
{
}

void bar (unsigned rop, unsigned long long *r)
{
  unsigned rs1, rs2, rd;

top:
  rs2 = (rop >> 23) & 0x1ff;
  rs1 = (rop >> 9) & 0x1ff;
  rd = rop & 0x1ff;

  *cp = 1;
  m = r[rs1] + r[rs2];
  *cp = 2;
  foo();
  if (!rd)
    goto top;
  r[rd] = 1;
}

int main(void)
{
  static unsigned long long r[64];
  unsigned long long cr;
  cp = &cr;

  r[4] = 47;
  r[8] = 11;
  bar((8 << 23) | (4 << 9) | 15, r);

  if (m != 47 + 11)
    abort ();
  exit (0);
}