diff options
author | Dale Johannesen <dalej@apple.com> | 2008-02-13 18:36:48 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-02-13 18:36:48 +0000 |
commit | 91ff7c089b09ae6e9840e530dec83d7ef3ced5f0 (patch) | |
tree | 4f0848829b8753c59e3597d1952750b6fec09c21 /test/C++Frontend | |
parent | 146d5af37804de3c482dde4e88e453622cb4039e (diff) | |
download | external_llvm-91ff7c089b09ae6e9840e530dec83d7ef3ced5f0.zip external_llvm-91ff7c089b09ae6e9840e530dec83d7ef3ced5f0.tar.gz external_llvm-91ff7c089b09ae6e9840e530dec83d7ef3ced5f0.tar.bz2 |
New test, see comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/C++Frontend')
-rw-r--r-- | test/C++Frontend/2008-02-13-sret.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/C++Frontend/2008-02-13-sret.cpp b/test/C++Frontend/2008-02-13-sret.cpp new file mode 100644 index 0000000..11595ba --- /dev/null +++ b/test/C++Frontend/2008-02-13-sret.cpp @@ -0,0 +1,48 @@ +// RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep retval | grep S242 | grep {i32 1} | count 2 + +// Test that all 8 bytes of ret in check242 are copied. llvm-gcc was +// treating S242 as if it were S93, which does not need to have the +// last 4 padding bytes copied. +typedef __builtin_va_list va_list; +typedef unsigned long size_t; +void *memset(void *, int, size_t); +struct S92 { int a:14; } ; + extern struct S92 s92; + + struct S92 check92 () { struct S92 ret; + memset (&ret, 0, sizeof (ret)); + ret.a = s92.a; + return ret; } + +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); } + |