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-pr51466.c
blob
b7a51666e5c35623ebcb6bcde678e63171be28d2
1
/*
2
pr51466.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
/* PR tree-optimization/51466 */
12
13
int
14
foo
(
int
i
)
15
{
16
volatile
int
v
[
4
];
17
int
*
p
;
18
v
[
i
] =
6
;
19
p
= (
int
*) &
v
[
i
];
20
return
*
p
;
21
}
22
23
int
24
bar
(
int
i
)
25
{
26
volatile
int
v
[
4
];
27
int
*
p
;
28
v
[
i
] =
6
;
29
p
= (
int
*) &
v
[
i
];
30
*
p
=
8
;
31
return
v
[
i
];
32
}
33
34
int
35
baz
(
int
i
)
36
{
37
volatile
int
v
[
4
];
38
int
*
p
;
39
v
[
i
] =
6
;
40
p
= (
int
*) &
v
[
0
];
41
*
p
=
8
;
42
return
v
[
i
];
43
}
44
45
void
46
testTortureExecute
(
void
)
47
{
48
if
(
foo
(
3
) !=
6
||
bar
(
2
) !=
8
||
baz
(
0
) !=
8
||
baz
(
1
) !=
6
)
49
ASSERT
(
0
);
50
return
;
51
}
52