// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion"
// RUN: %clang_cc1 -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE
// RUN: %clang_cc1 -fsanitize=implicit-integer-sign-change -fsanitize-recover=implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE
// RUN: %clang_cc1 -fsanitize=implicit-integer-sign-change -fsanitize-trap=implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK,CHECK-SANITIZE
// ========================================================================== //
// The expected true-negatives.
// ========================================================================== //
// Sanitization is explicitly disabled.
// ========================================================================== //
// CHECK-LABEL: @ignorelist_0
unsigned int
// CHECK-LABEL: @ignorelist_1
unsigned int
// CHECK-LABEL: @ignorelist_2
unsigned int
// CHECK-LABEL: @ignorelist_3
unsigned int
// Explicit sign-changing conversions.
// ========================================================================== //
// CHECK-LABEL: explicit_signed_int_to_unsigned_int
unsigned int
// CHECK-LABEL: explicit_unsigned_int_to_signed_int
signed int
// Explicit NOP conversions.
// ========================================================================== //
// CHECK-LABEL: @explicit_ununsigned_int_to_ununsigned_int
unsigned int
// CHECK-LABEL: @explicit_unsigned_int_to_unsigned_int
signed int
// conversions to to boolean type are not counted as sign-change.
// ========================================================================== //
// CHECK-LABEL: @unsigned_int_to_bool
_Bool
// CHECK-LABEL: @signed_int_to_bool
_Bool
// CHECK-LABEL: @explicit_unsigned_int_to_bool
_Bool
// CHECK-LABEL: @explicit_signed_int_to_bool
_Bool
// Explicit conversions from pointer to an integer.
// Can not have an implicit conversion from pointer to an integer.
// Can not have an implicit conversion between two enums.
// ========================================================================== //
// CHECK-LABEL: @explicit_voidptr_to_unsigned_int
unsigned int
// CHECK-LABEL: @explicit_voidptr_to_signed_int
signed int
// Implicit conversions from floating-point.
// ========================================================================== //
// CHECK-LABEL: @float_to_unsigned_int
unsigned int
// CHECK-LABEL: @float_to_signed_int
signed int
// CHECK-LABEL: @double_to_unsigned_int
unsigned int
// CHECK-LABEL: @double_to_signed_int
signed int
// Sugar.
// ========================================================================== //
typedef unsigned int uint32_t;
// CHECK-LABEL: @uint32_to_unsigned_int
unsigned int
// CHECK-LABEL: @unsigned_int_to_uint32
uint32_t
// CHECK-LABEL: @uint32_to_uint32
uint32_t
// "Transparent" Enum.
// ========================================================================== //
;
enum a ;
void ;
void ;
void