From 2ac03f488bb2f1caec96e8122cb9b89cfd435400 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 10 Nov 2001 07:26:59 +0000 Subject: [PATCH] Testcase for structure field reordering git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1247 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/StructModifyTest.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/StructModifyTest.c diff --git a/test/StructModifyTest.c b/test/StructModifyTest.c new file mode 100644 index 00000000000..e927ae45045 --- /dev/null +++ b/test/StructModifyTest.c @@ -0,0 +1,30 @@ +typedef struct { + int w; + float x; + double y; + long long z; +} S1Ty; + +typedef struct { + S1Ty A, B; +} S2Ty; + +void printS1(S1Ty *V) { + printf("%d, %f, %f, %lld\n", V->w, V->x, V->y, V->z); +} + +void main() { + S2Ty E; + E.A.w = 1; + E.A.x = 123.42f; + E.A.y = 19.0; + E.A.z = 123455678902ll; + E.B.w = 2; + E.B.x = 23.42f; + E.B.y = 29.0; + E.B.z = 23455678902ll; + + printS1(&E.A); + printS1(&E.B); +} +