blob: 15bfa2ddabdc4bd208ad2fbc2a712870fc72634c [file] [log] [blame]
Duncan Sands972378a2008-05-14 09:46:01 +00001// RUN: %llvmgxx -S -O1 -m32 -emit-llvm %s -o - | grep {store i32} | count 1
Dale Johannesen84ad8372008-02-13 18:36:48 +00002
Dale Johannesen35e11cd2008-02-15 22:05:15 +00003// Test that all 8 bytes of ret in check242 are copied, and only 4 bytes of
4// ret in check93 are copied (the same LLVM struct is used for both).
5
Dale Johannesen84ad8372008-02-13 18:36:48 +00006typedef __builtin_va_list va_list;
7typedef unsigned long size_t;
8void *memset(void *, int, size_t);
Dale Johannesen84ad8372008-02-13 18:36:48 +00009
10struct S93 { __attribute__((aligned (8))) void * a; } ;
11 extern struct S93 s93;
12 struct S93 check93 () {
13 struct S93 ret;
14 memset (&ret, 0, sizeof (ret));
15 ret.a = s93.a;
16 return ret; }
17
18struct S242 { char * a;int b[1]; } ;
19 extern struct S242 s242;
20
21 struct S242 check242 () {
22 struct S242 ret;
23 memset (&ret, 0, sizeof (ret));
24 ret.a = s242.a;
25 ret.b[0] = s242.b[0];
26 return ret; }
27
28void check93va (int z, ...) {
29 struct S93 arg;
30 va_list ap;
31 __builtin_va_start(ap,z);
32 arg = __builtin_va_arg(ap,struct S93);
33 __builtin_va_end(ap); }
34
35void check242va (int z, ...) {
36struct S242 arg;
37va_list ap;
38__builtin_va_start(ap,z);
39 arg = __builtin_va_arg(ap,struct S242);
40 __builtin_va_end(ap); }
41