repo.or.cz
/
tinycc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Relicensing TinyCC
[tinycc.git]
/
tests
/
tests2
/
121_struct_return.c
blob
147761b1bac680bf19f10019505f4a8c89c81cef
1
#include <stdio.h>
2
3
typedef
struct
{
4
int
data
[
4
];
5
double
d1
;
6
double
d2
;
7
}
Node
;
8
9
Node
init
(
Node self
) {
10
self
.
data
[
0
] =
0
;
11
self
.
data
[
1
] =
1
;
12
self
.
data
[
2
] =
2
;
13
self
.
data
[
3
] =
3
;
14
self
.
d1
=
1234
;
15
self
.
d2
=
2345
;
16
return
self
;
17
}
18
19
void
dummy
(
Node self
) {
20
}
21
22
void
print_data
(
Node data
) {
23
printf
(
"%d %d %d %d %g %g
\n
"
,
24
data
.
data
[
0
],
data
.
data
[
1
],
data
.
data
[
2
],
data
.
data
[
3
],
25
data
.
d1
,
data
.
d2
);
26
}
27
28
int
main
(
void
) {
29
/* This code resulted in a bounds checking error */
30
Node data
;
31
dummy
(
data
);
32
char
val
;
33
data
=
init
(
data
);
34
print_data
(
data
);
35
}