From 1c04435e5d33378ffa8eca65ca1ed35f3f9f4134 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 29 May 2023 11:37:32 +0200 Subject: field access --- test.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'test.c') diff --git a/test.c b/test.c index 1d6c01f..9a3aafb 100644 --- a/test.c +++ b/test.c @@ -13,7 +13,31 @@ int add (int x, int y) { return x + y + *glob; } -struct foo {struct foo *foo;}; +struct foo { + struct foo *foo; + struct n0 { + char z; + struct n1 { + char q; + struct n2 { + int ww; + } n2; + } n1; + } n0; + union { + struct { short x, y; }; + int xy; + }; + char flex[]; +}; + +int foop(struct foo *foo) { + if (foo->foo) foo = foo->foo; + ++foo->n0.n1.n2.ww; + int xy = (*foo).xy; + foo->flex[2] *= 5; + if (foo->x)return xy; else return foo->y; +} int abs(int x){ return (x ^ x >> 3\ -- cgit v1.2.3