// CHECK-NULL: @[[LINE_100:.*]] = private unnamed_addr global {{.*}}, i32 100, i32 5 {{.*}}
// PR6805
-// CHECK: @foo
-// CHECK-NULL: @foo
-// CHECK-TRAP: @foo
+// CHECK-LABEL: @foo
+// CHECK-NULL-LABEL: @foo
+// CHECK-TRAP-LABEL: @foo
void foo() {
union { int i; } u;
// CHECK: %[[CHECK0:.*]] = icmp ne {{.*}}* %[[PTR:.*]], null
u.i=1;
}
-// CHECK: @bar
-// CHECK-TRAP: @bar
+// CHECK-LABEL: @bar
+// CHECK-TRAP-LABEL: @bar
int bar(int *a) {
// CHECK: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64
// CHECK-NEXT: icmp uge i64 %[[SIZE]], 4
return *a;
}
-// CHECK: @addr_space
+// CHECK-LABEL: @addr_space
int addr_space(int __attribute__((address_space(256))) *a) {
// CHECK-NOT: __ubsan
return *a;
}
-// CHECK: @lsh_overflow
-// CHECK-TRAP: @lsh_overflow
+// CHECK-LABEL: @lsh_overflow
+// CHECK-TRAP-LABEL: @lsh_overflow
int lsh_overflow(int a, int b) {
// CHECK: %[[INBOUNDS:.*]] = icmp ule i32 %[[RHS:.*]], 31
// CHECK-NEXT: br i1 %[[INBOUNDS]], label %[[CHECKBB:.*]], label %[[CONTBB:.*]]
return a << b;
}
-// CHECK: @rsh_inbounds
-// CHECK-TRAP: @rsh_inbounds
+// CHECK-LABEL: @rsh_inbounds
+// CHECK-TRAP-LABEL: @rsh_inbounds
int rsh_inbounds(int a, int b) {
// CHECK: %[[INBOUNDS:.*]] = icmp ule i32 %[[RHS:.*]], 31
// CHECK: br i1 %[[INBOUNDS]]
return a >> b;
}
-// CHECK: @load
-// CHECK-TRAP: @load
+// CHECK-LABEL: @load
+// CHECK-TRAP-LABEL: @load
int load(int *p) {
// CHECK: call void @__ubsan_handle_type_mismatch(i8* bitcast ({{.*}} @[[LINE_500]] to i8*), i64 %{{.*}})
return *p;
}
-// CHECK: @store
-// CHECK-TRAP: @store
+// CHECK-LABEL: @store
+// CHECK-TRAP-LABEL: @store
void store(int *p, int q) {
// CHECK: call void @__ubsan_handle_type_mismatch(i8* bitcast ({{.*}} @[[LINE_600]] to i8*), i64 %{{.*}})
struct S { int k; };
-// CHECK: @member_access
-// CHECK-TRAP: @member_access
+// CHECK-LABEL: @member_access
+// CHECK-TRAP-LABEL: @member_access
int *member_access(struct S *p) {
// CHECK: call void @__ubsan_handle_type_mismatch(i8* bitcast ({{.*}} @[[LINE_700]] to i8*), i64 %{{.*}})
return &p->k;
}
-// CHECK: @signed_overflow
-// CHECK-TRAP: @signed_overflow
+// CHECK-LABEL: @signed_overflow
+// CHECK-TRAP-LABEL: @signed_overflow
int signed_overflow(int a, int b) {
// CHECK: %[[ARG1:.*]] = zext
// CHECK-NEXT: %[[ARG2:.*]] = zext
return a + b;
}
-// CHECK: @no_return
-// CHECK-TRAP: @no_return
+// CHECK-LABEL: @no_return
+// CHECK-TRAP-LABEL: @no_return
int no_return() {
// Reaching the end of a noreturn function is fine in C.
// FIXME: If the user explicitly requests -fsanitize=return, we should catch
// CHECK-TRAP: ret i32
}
-// CHECK: @vla_bound
+// CHECK-LABEL: @vla_bound
void vla_bound(int n) {
// CHECK: icmp sgt i32 %[[PARAM:.*]], 0
//
int arr[n * 3];
}
-// CHECK: @int_float_no_overflow
+// CHECK-LABEL: @int_float_no_overflow
float int_float_no_overflow(__int128 n) {
// CHECK-NOT: call void @__ubsan_handle
return n;
}
-// CHECK: @int_float_overflow
-// CHECK-TRAP: @int_float_overflow
+// CHECK-LABEL: @int_float_overflow
+// CHECK-TRAP-LABEL: @int_float_overflow
float int_float_overflow(unsigned __int128 n) {
// This is 2**104. FLT_MAX is 2**128 - 2**104.
// CHECK: icmp ule i128 %{{.*}}, -20282409603651670423947251286016
return n;
}
-// CHECK: @int_fp16_overflow
-// CHECK-TRAP: @int_fp16_overflow
+// CHECK-LABEL: @int_fp16_overflow
+// CHECK-TRAP-LABEL: @int_fp16_overflow
void int_fp16_overflow(int n, __fp16 *p) {
// CHECK: %[[GE:.*]] = icmp sge i32 %{{.*}}, -65504
// CHECK: %[[LE:.*]] = icmp sle i32 %{{.*}}, 65504
*p = n;
}
-// CHECK: @float_int_overflow
-// CHECK-TRAP: @float_int_overflow
+// CHECK-LABEL: @float_int_overflow
+// CHECK-TRAP-LABEL: @float_int_overflow
int float_int_overflow(float f) {
// CHECK: %[[GE:.*]] = fcmp ogt float %[[F:.*]], 0xC1E0000020000000
// CHECK: %[[LE:.*]] = fcmp olt float %[[F]], 0x41E0000000000000
return f;
}
-// CHECK: @long_double_int_overflow
-// CHECK-TRAP: @long_double_int_overflow
+// CHECK-LABEL: @long_double_int_overflow
+// CHECK-TRAP-LABEL: @long_double_int_overflow
int long_double_int_overflow(long double ld) {
// CHECK: alloca x86_fp80
// CHECK: %[[GE:.*]] = fcmp ogt x86_fp80 %[[F:.*]], 0xKC01E8000000100000000
return ld;
}
-// CHECK: @float_uint_overflow
-// CHECK-TRAP: @float_uint_overflow
+// CHECK-LABEL: @float_uint_overflow
+// CHECK-TRAP-LABEL: @float_uint_overflow
unsigned float_uint_overflow(float f) {
// CHECK: %[[GE:.*]] = fcmp ogt float %[[F:.*]], -1.{{0*}}e+00
// CHECK: %[[LE:.*]] = fcmp olt float %[[F]], 0x41F0000000000000
return f;
}
-// CHECK: @fp16_char_overflow
-// CHECK-TRAP: @fp16_char_overflow
+// CHECK-LABEL: @fp16_char_overflow
+// CHECK-TRAP-LABEL: @fp16_char_overflow
signed char fp16_char_overflow(__fp16 *p) {
// CHECK: %[[GE:.*]] = fcmp ogt float %[[F:.*]], -1.29{{0*}}e+02
// CHECK: %[[LE:.*]] = fcmp olt float %[[F]], 1.28{{0*}}e+02
return *p;
}
-// CHECK: @float_float_overflow
-// CHECK-TRAP: @float_float_overflow
+// CHECK-LABEL: @float_float_overflow
+// CHECK-TRAP-LABEL: @float_float_overflow
float float_float_overflow(double f) {
// CHECK: %[[F:.*]] = call double @llvm.fabs.f64(
// CHECK: %[[GE:.*]] = fcmp ogt double %[[F]], 0x47EFFFFFE0000000
return f;
}
-// CHECK: @int_divide_overflow
-// CHECK-OVERFLOW: @int_divide_overflow
+// CHECK-LABEL: @int_divide_overflow
+// CHECK-OVERFLOW-LABEL: @int_divide_overflow
int int_divide_overflow(int a, int b) {
// CHECK: %[[ZERO:.*]] = icmp ne i32 %[[B:.*]], 0
// CHECK-OVERFLOW-NOT: icmp ne i32 %{{.*}}, 0
// CHECK-TRAP: }
}
-// CHECK: @sour_bool
+// CHECK-LABEL: @sour_bool
_Bool sour_bool(_Bool *p) {
// CHECK: %[[OK:.*]] = icmp ule i8 {{.*}}, 1
// CHECK: br i1 %[[OK]]
struct T : S {};
-// CHECK: @_Z17reference_binding
+// CHECK-LABEL: @_Z17reference_binding
void reference_binding(int *p, S *q) {
// C++ core issue 453: If an lvalue to which a reference is directly bound
// designates neither an existing object or function of an appropriate type,
S &r2 = *q;
}
-// CHECK: @_Z13member_access
+// CHECK-LABEL: @_Z13member_access
void member_access(S *p) {
// (1a) Check 'p' is appropriately sized and aligned for member access.
k = p->f();
}
-// CHECK: @_Z12lsh_overflow
+// CHECK-LABEL: @_Z12lsh_overflow
int lsh_overflow(int a, int b) {
// CHECK: %[[INBOUNDS:.*]] = icmp ule i32 %[[RHS:.*]], 31
// CHECK-NEXT: br i1 %[[INBOUNDS]]
return a << b;
}
-// CHECK: @_Z9no_return
+// CHECK-LABEL: @_Z9no_return
int no_return() {
// CHECK: call void @__ubsan_handle_missing_return(i8* bitcast ({{.*}}* @{{.*}} to i8*)) [[NR_NUW:#[0-9]+]]
// CHECK-NEXT: unreachable
}
-// CHECK: @_Z9sour_bool
+// CHECK-LABEL: @_Z9sour_bool
bool sour_bool(bool *p) {
// CHECK: %[[OK:.*]] = icmp ule i8 {{.*}}, 1
// CHECK: br i1 %[[OK]]
enum E2 { e2a = -1, e2b = 64 } e2;
enum E3 { e3a = (1u << 31) - 1 } e3;
-// CHECK: @_Z14bad_enum_value
+// CHECK-LABEL: @_Z14bad_enum_value
int bad_enum_value() {
// CHECK: %[[E1:.*]] = icmp ule i32 {{.*}}, 127
// CHECK: br i1 %[[E1]]
return a + b + c;
}
-// CHECK: @_Z20bad_downcast_pointer
+// CHECK-LABEL: @_Z20bad_downcast_pointer
void bad_downcast_pointer(S *p) {
// CHECK: %[[NONNULL:.*]] = icmp ne {{.*}}, null
// CHECK: br i1 %[[NONNULL]],
(void) static_cast<T*>(p);
}
-// CHECK: @_Z22bad_downcast_reference
+// CHECK-LABEL: @_Z22bad_downcast_reference
void bad_downcast_reference(S &p) {
// CHECK: %[[E1:.*]] = icmp ne {{.*}}, null
// CHECK-NOT: br i1
(void) static_cast<T&>(p);
}
-// CHECK: @_Z11array_index
+// CHECK-LABEL: @_Z11array_index
int array_index(const int (&a)[4], int n) {
// CHECK: %[[K1_OK:.*]] = icmp ult i64 %{{.*}}, 4
// CHECK: br i1 %[[K1_OK]]
return k1 + *r1 + k2;
}
-// CHECK: @_Z17multi_array_index
+// CHECK-LABEL: @_Z17multi_array_index
int multi_array_index(int n, int m) {
int arr[4][6];
return arr[n][m];
}
-// CHECK: @_Z11array_arith
+// CHECK-LABEL: @_Z11array_arith
int array_arith(const int (&a)[4], int n) {
// CHECK: %[[K1_OK:.*]] = icmp ule i64 %{{.*}}, 4
// CHECK: br i1 %[[K1_OK]]
int a1[5];
int a2[1];
};
-// CHECK: @_Z18struct_array_index
+// CHECK-LABEL: @_Z18struct_array_index
int struct_array_index(ArrayMembers *p, int n) {
// CHECK: %[[IDX_OK:.*]] = icmp ult i64 %{{.*}}, 5
// CHECK: br i1 %[[IDX_OK]]
return p->a1[n];
}
-// CHECK: @_Z16flex_array_index
+// CHECK-LABEL: @_Z16flex_array_index
int flex_array_index(ArrayMembers *p, int n) {
// CHECK-NOT: call void @__ubsan_handle_out_of_bounds(
return p->a2[n];
}
extern int incomplete[];
-// CHECK: @_Z22incomplete_array_index
+// CHECK-LABEL: @_Z22incomplete_array_index
int incomplete_array_index(int n) {
// CHECK-NOT: call void @__ubsan_handle_out_of_bounds(
return incomplete[n];
}
typedef __attribute__((ext_vector_type(4))) int V4I;
-// CHECK: @_Z12vector_index
+// CHECK-LABEL: @_Z12vector_index
int vector_index(V4I v, int n) {
// CHECK: %[[IDX_OK:.*]] = icmp ult i64 %{{.*}}, 4
// CHECK: br i1 %[[IDX_OK]]
return v[n];
}
-// CHECK: @_Z12string_index
+// CHECK-LABEL: @_Z12string_index
char string_index(int n) {
// CHECK: %[[IDX_OK:.*]] = icmp ult i64 %{{.*}}, 6
// CHECK: br i1 %[[IDX_OK]]