xref: /llvm-project/clang/test/CodeGen/arm-vaarg.c (revision 6d973b4548e281d0b8e75e85833804bb45b6a0e8)
1 // RUN: %clang -mfloat-abi=soft -target arm-linux-gnu -emit-llvm -S -o - %s | FileCheck %s
2 
3 struct Empty {};
4 
5 struct Empty emptyvar;
6 
take_args(int a,...)7 void take_args(int a, ...) {
8 // CHECK: [[ALLOCA_VA_LIST:%[a-zA-Z0-9._]+]] = alloca %struct.__va_list, align 4
9 // CHECK: call void @llvm.va_start
10 
11   // It's conceivable that EMPTY_PTR may not actually be a valid pointer
12   // (e.g. it's at the very bottom of the stack and the next page is
13   // invalid). This doesn't matter provided it's never loaded (there's no
14   // well-defined way to tell), but it becomes a problem if we do try to use it.
15 // CHECK-NOT: load %struct.Empty
16   __builtin_va_list l;
17   __builtin_va_start(l, a);
18   emptyvar = __builtin_va_arg(l, struct Empty);
19   __builtin_va_end(l);
20 }
21