aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-05-01 06:18:48 +0200
committerMichael Matz <matz@suse.de>2017-05-01 06:18:48 +0200
commit8d9dd3c0088d69d7742889c3267e5b1a138641b0 (patch)
treed29666fc313261ccb106b98f01c7a868a363d4c5 /tests
parent4ce73354fc5e555934bc721e2ab53936df6628e0 (diff)
downloadtinycc-8d9dd3c0088d69d7742889c3267e5b1a138641b0.tar.gz
tinycc-8d9dd3c0088d69d7742889c3267e5b1a138641b0.tar.bz2
Fix more bitfield corner cases
Our code generation assumes that it can load/store with the bit-fields base type, so bit_pos/bit_size must be in range for this. We could change the fields type or adjust offset/bit_pos; we do the latter.
Diffstat (limited to 'tests')
-rw-r--r--tests/tcctest.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index dc6a060..aee0120 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -2082,6 +2082,12 @@ void bitfield_test(void)
char c;
} st5 = { 1, 2, 3, 4, -3, 6 };
printf("st5 = %d %d %d %d %d %d\n", st5.a, st5.b, st5.x, st5.y, st5.z, st5.c);
+ struct sbf6 {
+ short x : 12;
+ unsigned char y : 2;
+ } st6;
+ st6.y = 1;
+ printf("st6.y == %d\n", st6.y);
}
#ifdef __x86_64__