projects
/
libfirm
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
call optimize_cf() to delete dead-code that might arise after cond_eval
[libfirm]
/
ir
/
be
/
test
/
bf_constfold.c
1
//#include <stdio.h>
2
3
/* Demonstrates a bug where constant folding ignores width of bitfields */
4
5
#ifdef __GNUC__
6
#define PACKED __attribute__((packed))
7
#else
8
#define PACKED
9
#endif
10
11
struct PACKED A
12
{
13
unsigned int i:1, l:1, j:3, k:11;
14
};
15
struct A sA;
16
17
int main()
18
{
19
unsigned int mask;
20
struct A x;
21
22
sA.k = -1;
23
mask = sA.k;
24
x = sA;
25
26
printf("Val1: %x (expected 7ff) val2: %x (expected 7ff)\n", mask, x.k);
27
28
return 0;
29
}