blob: f55bd878b09bf6ac7812638d33f20b72e5072329 (
plain) (
blame)
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
44
45
46
47
48
49
50
51
52
53
|
/*
20080522-1.c from the execute part of the gcc torture tests.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c99
#endif
/* This testcase is to make sure we have i in referenced vars and that we
properly compute aliasing for the loads and stores. */
static int i;
static int *p = &i;
int
foo(int *q)
{
*p = 1;
*q = 2;
return *p;
}
int
bar(int *q)
{
*q = 2;
*p = 1;
return *q;
}
void
testTortureExecute (void)
{
int j = 0;
if (foo(&i) != 2)
ASSERT (0);
if (bar(&i) != 1)
ASSERT (0);
if (foo(&j) != 1)
ASSERT (0);
if (j != 2)
ASSERT (0);
if (bar(&j) != 2)
ASSERT (0);
if (j != 2)
ASSERT (0);
return;
}
|