diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:08:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-09 19:08:19 +0000 |
commit | 798321d8eb5630cd4a8f490a4f25e32ef195fb07 (patch) | |
tree | a59f5569ef36d00388c0428426abef26aa9105b6 /test/CodeGen/catch-undef-behavior.c | |
parent | 5e20cdd81c44a443562a09007668ffdf76c455af (diff) |
Diffstat (limited to 'test/CodeGen/catch-undef-behavior.c')
-rw-r--r-- | test/CodeGen/catch-undef-behavior.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/CodeGen/catch-undef-behavior.c b/test/CodeGen/catch-undef-behavior.c index a4386588757d1..66954190aff7a 100644 --- a/test/CodeGen/catch-undef-behavior.c +++ b/test/CodeGen/catch-undef-behavior.c @@ -371,6 +371,34 @@ void call_decl_nonnull(int *a) { decl_nonnull(a); } +extern void *memcpy (void *, const void *, unsigned) __attribute__((nonnull(1, 2))); + +// CHECK-COMMON-LABEL: @call_memcpy_nonnull +void call_memcpy_nonnull(void *p, void *q, int sz) { + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + memcpy(p, q, sz); +} + +extern void *memmove (void *, const void *, unsigned) __attribute__((nonnull(1, 2))); + +// CHECK-COMMON-LABEL: @call_memmove_nonnull +void call_memmove_nonnull(void *p, void *q, int sz) { + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + + // CHECK-COMMON: icmp ne i8* {{.*}}, null + // CHECK-UBSAN: call void @__ubsan_handle_nonnull_arg + // CHECK-TRAP: call void @llvm.trap() + memmove(p, q, sz); +} + // CHECK-COMMON-LABEL: @call_nonnull_variadic __attribute__((nonnull)) void nonnull_variadic(int a, ...); void call_nonnull_variadic(int a, int *b) { |