blob: 8ad204701975fe70869978e593abfe8852bcb986 [file] [log] [blame]
Duncan Sands54221ad2008-02-15 19:42:13 +00001// RUN: %llvmgxx -S -O0 -emit-llvm %s -o - | grep {retval\\|memtmp} | grep S242 | \
2// RUN: grep {i32 1} | count 2
Dale Johannesen91ff7c02008-02-13 18:36:48 +00003
4// Test that all 8 bytes of ret in check242 are copied. llvm-gcc was
5// treating S242 as if it were S93, which does not need to have the
6// last 4 padding bytes copied.
7typedef __builtin_va_list va_list;
8typedef unsigned long size_t;
9void *memset(void *, int, size_t);
10struct S92 { int a:14; } ;
11 extern struct S92 s92;
12
13 struct S92 check92 () { struct S92 ret;
14 memset (&ret, 0, sizeof (ret));
15 ret.a = s92.a;
16 return ret; }
17
18struct S93 { __attribute__((aligned (8))) void * a; } ;
19 extern struct S93 s93;
20 struct S93 check93 () {
21 struct S93 ret;
22 memset (&ret, 0, sizeof (ret));
23 ret.a = s93.a;
24 return ret; }
25
26struct S242 { char * a;int b[1]; } ;
27 extern struct S242 s242;
28
29 struct S242 check242 () {
30 struct S242 ret;
31 memset (&ret, 0, sizeof (ret));
32 ret.a = s242.a;
33 ret.b[0] = s242.b[0];
34 return ret; }
35
36void check93va (int z, ...) {
37 struct S93 arg;
38 va_list ap;
39 __builtin_va_start(ap,z);
40 arg = __builtin_va_arg(ap,struct S93);
41 __builtin_va_end(ap); }
42
43void check242va (int z, ...) {
44struct S242 arg;
45va_list ap;
46__builtin_va_start(ap,z);
47 arg = __builtin_va_arg(ap,struct S242);
48 __builtin_va_end(ap); }
49