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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [pta-ptrarith-3.c] - Blame information for rev 754

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-fdump-tree-alias" } */
3
/* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */
4
 
5
extern void abort (void);
6
struct X {
7
  int *p;
8
  int *q;
9
  int *r;
10
};
11
int __attribute__((noinline))
12
foo(int i, int j, int k, int off)
13
{
14
  struct X x;
15
  int **p, *q;
16
  x.p = &i;
17
  x.q = &j;
18
  x.r = &k;
19
  p = &x.q;
20
  p += off;
21
  /* *p points to { i, j, k } */
22
  q = *p;
23
  return *q;
24
}
25
int main()
26
{
27
  if (foo(1, 2, 3, -1) != 1)
28
    abort ();
29
  if (foo(1, 2, 3, 0) != 2)
30
    abort ();
31
  if (foo(1, 2, 3, 1) != 3)
32
    abort ();
33
  return 0;
34
}
35
 
36
/* { dg-final { scan-tree-dump "q_., points-to vars: { i j k }" "alias" } } */
37
/* { dg-final { cleanup-tree-dump "alias" } } */

powered by: WebSVN 2.1.0

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