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
struct / union in initializer, RFE #901.
[sdcc.git]
/
sdcc
/
support
/
regression
/
tests
/
gcc-torture-execute-loop-5.c
blob
bada8cdebd14bebf7a9506a063aa78050ba3edef
1
/*
2
loop-5.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
static int
ap
(
int
i
);
12
static void
testit
(
void
){
13
int
ir
[
4
] = {
0
,
1
,
2
,
3
};
14
int
ix
,
n
,
m
;
15
n
=
1
;
m
=
3
;
16
for
(
ix
=
1
;
ix
<=
4
;
ix
++) {
17
if
(
n
==
1
)
m
=
4
;
18
else
m
=
n
-
1
;
19
ap
(
ir
[
n
-
1
]);
20
n
=
m
;
21
}
22
}
23
24
static int
t
=
0
;
25
static int
a
[
4
];
26
27
static int
ap
(
int
i
){
28
if
(
t
>
3
)
29
ASSERT
(
0
);
30
a
[
t
++] =
i
;
31
return
1
;
32
}
33
34
void
35
testTortureExecute
(
void
)
36
{
37
testit
();
38
if
(
a
[
0
] !=
0
)
39
ASSERT
(
0
);
40
if
(
a
[
1
] !=
3
)
41
ASSERT
(
0
);
42
if
(
a
[
2
] !=
2
)
43
ASSERT
(
0
);
44
if
(
a
[
3
] !=
1
)
45
ASSERT
(
0
);
46
return
;
47
}