1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
2
3 typedef __SIZE_TYPE__ size_t;
4
5 void *malloc(size_t);
6 void *calloc(size_t, size_t);
7 void *realloc(void *, size_t);
8 void *aligned_alloc(size_t, size_t);
9 void *memalign(size_t, size_t);
10
malloc_test(size_t n)11 void *malloc_test(size_t n) {
12 return malloc(n);
13 }
14
calloc_test(size_t e,size_t n)15 void *calloc_test(size_t e, size_t n) {
16 return calloc(e, n);
17 }
18
realloc_test(void * p,size_t n)19 void *realloc_test(void *p, size_t n) {
20 return realloc(p, n);
21 }
22
aligned_alloc_test(size_t n,size_t a)23 void *aligned_alloc_test(size_t n, size_t a) {
24 return aligned_alloc(a, n);
25 }
26
memalign_test(size_t n,size_t a)27 void *memalign_test(size_t n, size_t a) {
28 return memalign(a, n);
29 }
30
31 // CHECK: @malloc(i64 noundef) #1
32 // CHECK: @calloc(i64 noundef, i64 noundef) #2
33 // CHECK: @realloc(ptr noundef, i64 noundef) #3
34 // CHECK: @aligned_alloc(i64 noundef, i64 noundef) #3
35 // CHECK: @memalign(i64 noundef, i64 noundef) #3
36
37 // CHECK: attributes #1 = { allocsize(0)
38 // CHECK: attributes #2 = { allocsize(0,1)
39 // CHECK: attributes #3 = { allocsize(1)
40