From 0368070045f0ebcdcb12d49da9edc4d10ca30c60 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 15 Sep 2025 22:43:25 +0200 Subject: frontend: more bitfield work --- test/test4.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/test4.c b/test/test4.c index c2dcd5f..c1c9429 100644 --- a/test/test4.c +++ b/test/test4.c @@ -1,5 +1,5 @@ int xor(int a) { - return a ^ 3 | 233333; + return a ^ 3 | 555; } int cmp(float x, float y) { @@ -7,18 +7,34 @@ int cmp(float x, float y) { } struct foo { - int x : 10; + unsigned int x : 10; unsigned y : 7; short k:3; int : 0; short a:15; + long long h:60; }; int bitf(struct foo *q) { + extern void aeiou(int); + aeiou(q->h); return q->x + q->y - q->k + q->a; } -int main() { +int main(int p) { + extern int printf(const char *, ...); + + static struct foo foo; + + foo.x = 5+p; + foo.k = 3; + foo.h += 7; + bitf(&foo); + foo.a = -1; + foo.a = xor(foo.a |= 3); + printf("expect %d, -4, 7, %d\n", 5+p, (short)((-1|3)^3|555)); + printf(" %d, %d, %lld, %d\n", foo.x, foo.k+=1, foo.h, foo.a); + int x = 42, *a = &x, **b = &a, @@ -29,3 +45,4 @@ int main() { return ******f; } +void aeiou(int _){} -- cgit v1.2.3