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/] [20080522-1.c] - Blame information for rev 308

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

Line No. Rev Author Line
1 297 jeremybenn
/* This testcase is to make sure we have i in referenced vars and that we
2
   properly compute aliasing for the loads and stores.  */
3
 
4
extern void abort (void);
5
 
6
static int i;
7
static int *p = &i;
8
 
9
int __attribute__((noinline))
10
foo(int *q)
11
{
12
  *p = 1;
13
  *q = 2;
14
  return *p;
15
}
16
 
17
int __attribute__((noinline))
18
bar(int *q)
19
{
20
  *q = 2;
21
  *p = 1;
22
  return *q;
23
}
24
 
25
int main()
26
{
27
  int j = 0;
28
 
29
  if (foo(&i) != 2)
30
    abort ();
31
  if (bar(&i) != 1)
32
    abort ();
33
  if (foo(&j) != 1)
34
    abort ();
35
  if (j != 2)
36
    abort ();
37
  if (bar(&j) != 2)
38
    abort ();
39
  if (j != 2)
40
    abort ();
41
 
42
  return 0;
43
}

powered by: WebSVN 2.1.0

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