From 7ca0689b9b3f085d398062f7f09059f7be691829 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Tue, 6 Mar 2007 03:00:17 +0000 Subject: [PATCH] Test to ensure that data layout is generated correctly for host platform. This is for PR1242. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34944 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CFrontend/2007-03-05-DataLayout.c | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 test/CFrontend/2007-03-05-DataLayout.c diff --git a/test/CFrontend/2007-03-05-DataLayout.c b/test/CFrontend/2007-03-05-DataLayout.c new file mode 100644 index 00000000000..701cb798b61 --- /dev/null +++ b/test/CFrontend/2007-03-05-DataLayout.c @@ -0,0 +1,51 @@ +// Testcase for PR1242 +// RUN: %llvmgcc -c %s -o %t && lli --force-interpreter=1 %t +#include +#define NDIM 3 +#define BODY 01 +typedef double vector[NDIM]; +typedef struct bnode* bodyptr; +// { i16, double, [3 x double], i32, i32, [3 x double], [3 x double], [3 x +// double], double, \2 *, \2 * } +struct bnode { + short int type; + double mass; + vector pos; + int proc; + int new_proc; + vector vel; + vector acc; + vector new_acc; + double phi; + bodyptr next; + bodyptr proc_next; +} body; + +#define Type(x) ((x)->type) +#define Mass(x) ((x)->mass) +#define Pos(x) ((x)->pos) +#define Proc(x) ((x)->proc) +#define New_Proc(x) ((x)->new_proc) +#define Vel(x) ((x)->vel) +#define Acc(x) ((x)->acc) +#define New_Acc(x) ((x)->new_acc) +#define Phi(x) ((x)->phi) +#define Next(x) ((x)->next) +#define Proc_Next(x) ((x)->proc_next) + +bodyptr ubody_alloc(int p) +{ + register bodyptr tmp; + tmp = (bodyptr)malloc(sizeof(body)); + + Type(tmp) = BODY; + Proc(tmp) = p; + Proc_Next(tmp) = NULL; + New_Proc(tmp) = p; + return tmp; +} + +int main(int argc, char** argv) { + bodyptr b = ubody_alloc(17); + return 0; +} -- 2.11.0