Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
b1b98c1e
Commit
b1b98c1e
authored
Dec 12, 2006
by
Matthias Braun
Browse files
output results
parent
d2d03d76
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/be/test/bf_init.c
View file @
b1b98c1e
...
...
@@ -8,14 +8,22 @@ struct bf {
char
c
;
double
d
;
unsigned
w
:
9
;
}
__attribute__
((
packed
))
;
};
struct
bf
mybf
=
{
0xffffffff
,
4097
,
65537
,
5
,
0xff
,
4
.
5
,
257
};
int
main
(
void
)
{
dumpMem
(
&
mybf
,
sizeof
mybf
);
printf
(
"sizeof mybf %d
\n
"
,
sizeof
mybf
);
//dumpMem(&mybf, sizeof mybf);
//printf("sizeof mybf %d\n", sizeof mybf);
printf
(
"int a (expected -1): %d
\n
"
,
mybf
.
a
);
printf
(
"unsigned x:13 (expected 4097): %u
\n
"
,
mybf
.
x
);
printf
(
"unsigned y:17 (expected 65537): %u
\n
"
,
mybf
.
y
);
printf
(
"unsigned y:3 (expected 5): %u
\n
"
,
mybf
.
z
);
printf
(
"char c (expected ff): %x
\n
"
,
mybf
.
c
);
printf
(
"double d (expected 4.5): %.1f
\n
"
,
mybf
.
d
);
printf
(
"unsigned w:9 (expected 257): %u
\n
"
,
mybf
.
w
);
return
0
;
}
ir/be/test/bf_localinit.c
View file @
b1b98c1e
...
...
@@ -8,18 +8,28 @@ struct bf {
char
c
;
double
d
;
unsigned
w
:
9
;
}
__attribute__
((
packed
))
;
};
#define offsetof(TYPE, MEMB) ((size_t) &((TYPE *)0)->MEMB)
int
main
(
void
)
{
struct
bf
mybf
=
{
0xffffffff
,
4097
,
65537
,
5
,
0xff
,
4
.
5
,
257
};
#if 0
dumpMem(&mybf, sizeof mybf);
printf("sizeof mybf %d\n", sizeof mybf);
printf("offset a = %d\n", offsetof(struct bf, a));
printf("offset c = %d\n", offsetof(struct bf, c));
printf("offset d = %d\n", offsetof(struct bf, d));
#endif
printf
(
"int a (expected -1): %d
\n
"
,
mybf
.
a
);
printf
(
"unsigned x:13 (expected 4097): %u
\n
"
,
mybf
.
x
);
printf
(
"unsigned y:17 (expected 65537): %u
\n
"
,
mybf
.
y
);
printf
(
"unsigned y:3 (expected 5): %u
\n
"
,
mybf
.
z
);
printf
(
"char c (expected ff): %x
\n
"
,
mybf
.
c
);
printf
(
"double d (expected 4.5): %.1f
\n
"
,
mybf
.
d
);
printf
(
"unsigned w:9 (expected 257): %u
\n
"
,
mybf
.
w
);
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment