diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-05-29 19:17:15 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-05-29 19:17:15 +0000 |
commit | 0b85642898bd81209e56e8098c065e2975d455a0 (patch) | |
tree | 9059e4d73006c90d725ee560da049a3ff6b66691 /test/FrontendC++/2008-02-13-sret.cpp | |
parent | fcc6350ac9b99d6590f5256d26bfa489b4531fb3 (diff) |
For PR1338: Rename test dirs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FrontendC++/2008-02-13-sret.cpp')
-rw-r--r-- | test/FrontendC++/2008-02-13-sret.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/FrontendC++/2008-02-13-sret.cpp b/test/FrontendC++/2008-02-13-sret.cpp new file mode 100644 index 0000000000..15bfa2ddab --- /dev/null +++ b/test/FrontendC++/2008-02-13-sret.cpp @@ -0,0 +1,41 @@ +// RUN: %llvmgxx -S -O1 -m32 -emit-llvm %s -o - | grep {store i32} | count 1 + +// Test that all 8 bytes of ret in check242 are copied, and only 4 bytes of +// ret in check93 are copied (the same LLVM struct is used for both). + +typedef __builtin_va_list va_list; +typedef unsigned long size_t; +void *memset(void *, int, size_t); + +struct S93 { __attribute__((aligned (8))) void * a; } ; + extern struct S93 s93; + struct S93 check93 () { + struct S93 ret; + memset (&ret, 0, sizeof (ret)); + ret.a = s93.a; + return ret; } + +struct S242 { char * a;int b[1]; } ; + extern struct S242 s242; + + struct S242 check242 () { + struct S242 ret; + memset (&ret, 0, sizeof (ret)); + ret.a = s242.a; + ret.b[0] = s242.b[0]; + return ret; } + +void check93va (int z, ...) { + struct S93 arg; + va_list ap; + __builtin_va_start(ap,z); + arg = __builtin_va_arg(ap,struct S93); + __builtin_va_end(ap); } + +void check242va (int z, ...) { +struct S242 arg; +va_list ap; +__builtin_va_start(ap,z); + arg = __builtin_va_arg(ap,struct S242); + __builtin_va_end(ap); } + |