From 5c0a2366a3bb5bdeb3b3617389d4584375d5bfbc Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 15 Apr 2012 01:06:46 +0200 Subject: Fix bitfield loads into char/short. Removes a premature optimization of char/short loads rewriting the source type. It did so also for bitfield loads, thereby removing all the shifts/maskings. --- tests/tcctest.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/tcctest.c b/tests/tcctest.c index 723adc1..afb0825 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -1461,6 +1461,8 @@ void c99_bool_test(void) void bitfield_test(void) { int a; + short sa; + unsigned char ca; struct sbf1 { int f1 : 3; int : 2; @@ -1482,6 +1484,9 @@ void bitfield_test(void) st1.f5++; printf("%d %d %d %d %d\n", st1.f1, st1.f2, st1.f3, st1.f4, st1.f5); + sa = st1.f5; + ca = st1.f5; + printf("%d %d\n", sa, ca); st1.f1 = 7; if (st1.f1 == -1) -- cgit v1.3.1