projects
/
libfirm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9d46b01
)
test constant folding with bitset values
author
Matthias Braun
<matze@braunis.de>
Fri, 9 Feb 2007 13:55:20 +0000
(13:55 +0000)
committer
Matthias Braun
<matze@braunis.de>
Fri, 9 Feb 2007 13:55:20 +0000
(13:55 +0000)
ir/be/test/bf_constfold.c
[new file with mode: 0644]
patch
|
blob
diff --git a/ir/be/test/bf_constfold.c
b/ir/be/test/bf_constfold.c
new file mode 100644
(file)
index 0000000..
28036c1
--- /dev/null
+++ b/
ir/be/test/bf_constfold.c
@@ -0,0
+1,23
@@
+#include <stdio.h>
+
+/* Demonstrates a bug where constant folding ignores width of bitfields */
+
+struct __attribute__((packed)) A
+{
+ unsigned int i:1, l:1, j:3, k:11;
+};
+struct A sA;
+
+int main()
+{
+ unsigned int mask;
+ struct A x;
+
+ sA.k = -1;
+ mask = sA.k;
+ x = sA;
+
+ printf("Val1: %x (expected 7ff) val2: %x (expected 7ff)\n", mask, x.k);
+
+ return 0;
+}