aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/Generic/struct.c
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-08-11 14:16:34 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-08-11 14:16:34 +0000
commit5b160f19c677b9e4508ef91ee86894f3d204eaa3 (patch)
treea2c9a3022a2f1bf3fdce66f6e3b631aeffdcc37f /test/CodeGen/Generic/struct.c
parent9582822341bd8a7847b1f796be19c621a74bd616 (diff)
downloadexternal_llvm-5b160f19c677b9e4508ef91ee86894f3d204eaa3.zip
external_llvm-5b160f19c677b9e4508ef91ee86894f3d204eaa3.tar.gz
external_llvm-5b160f19c677b9e4508ef91ee86894f3d204eaa3.tar.bz2
Simple hand-coded tests to aid in early development of backends, along with a
Makefile to run ad-hoc tests easily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Generic/struct.c')
-rw-r--r--test/CodeGen/Generic/struct.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/CodeGen/Generic/struct.c b/test/CodeGen/Generic/struct.c
new file mode 100644
index 0000000..c4181bc
--- /dev/null
+++ b/test/CodeGen/Generic/struct.c
@@ -0,0 +1,39 @@
+void printf(char*, ...);
+
+typedef struct params_ {
+ int i1;
+ float f1;
+ double d1;
+ short s1;
+ double d2;
+ char c1;
+ unsigned short s2;
+ float f2;
+ int i2;
+} params;
+
+void print_param(params p) {
+ printf("%d, %f, %f, %d, %f, %c, %d, %f, %d\n",
+ p.i1, p.f1, p.d1, p.s1, p.d2, p.c1, p.s2, p.f2, p.i2);
+}
+
+void print_param_addr(params *p) {
+ printf("%d, %f, %f, %d, %f, %c, %d, %f, %d\n",
+ p->i1, p->f1, p->d1, p->s1, p->d2, p->c1, p->s2, p->f2, p->i2);
+}
+
+int main() {
+ params p;
+ p.i1 = 1;
+ p.f1 = 2.0;
+ p.d1 = 3.0;
+ p.s1 = 4;
+ p.d2 = 5.0;
+ p.c1 = '6';
+ p.s2 = 7;
+ p.f2 = 8.0;
+ p.i2 = 9;
+ print_param(p);
+ print_param_addr(&p);
+ return 0;
+}