repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git]
/
sdcc
/
support
/
regression
/
tests
/
gcc-torture-execute-20080522-1.c
blob
f55bd878b09bf6ac7812638d33f20b72e5072329
1
/*
2
20080522-1.c from the execute part of the gcc torture tests.
3
*/
4
5
#include <testfwk.h>
6
7
#ifdef __SDCC
8
#pragma std_c99
9
#endif
10
11
/* This testcase is to make sure we have i in referenced vars and that we
12
properly compute aliasing for the loads and stores. */
13
14
static int
i
;
15
static int
*
p
= &
i
;
16
17
int
18
foo
(
int
*
q
)
19
{
20
*
p
=
1
;
21
*
q
=
2
;
22
return
*
p
;
23
}
24
25
int
26
bar
(
int
*
q
)
27
{
28
*
q
=
2
;
29
*
p
=
1
;
30
return
*
q
;
31
}
32
33
void
34
testTortureExecute
(
void
)
35
{
36
int
j
=
0
;
37
38
if
(
foo
(&
i
) !=
2
)
39
ASSERT
(
0
);
40
if
(
bar
(&
i
) !=
1
)
41
ASSERT
(
0
);
42
if
(
foo
(&
j
) !=
1
)
43
ASSERT
(
0
);
44
if
(
j
!=
2
)
45
ASSERT
(
0
);
46
if
(
bar
(&
j
) !=
2
)
47
ASSERT
(
0
);
48
if
(
j
!=
2
)
49
ASSERT
(
0
);
50
51
return
;
52
}
53