summaryrefslogtreecommitdiff
path: root/test/ubsan/TestCases
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 18:00:15 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 18:00:15 +0000
commit63714eb5809e39666dec2454c354195e76f916ba (patch)
treee3714cd783c265396c2ef3c117047e7c0ea41619 /test/ubsan/TestCases
parent0646903fc1f75f6e605754621119473ee083f4a4 (diff)
Notes
Diffstat (limited to 'test/ubsan/TestCases')
-rw-r--r--test/ubsan/TestCases/Float/cast-overflow.cpp167
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/integer-arithmetic-value-change.c345
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/integer-conversion.c351
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/integer-sign-change-blacklist.c28
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/integer-sign-change-summary.cpp13
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/integer-sign-change.c297
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/integer-truncation.c324
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-blacklist.c60
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c58
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-summary.cpp13
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-summary.cpp13
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation.c318
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-blacklist.c60
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-summary.cpp13
-rw-r--r--test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation.c304
-rw-r--r--test/ubsan/TestCases/Integer/add-overflow.cpp32
-rw-r--r--test/ubsan/TestCases/Integer/div-overflow.cpp10
-rw-r--r--test/ubsan/TestCases/Integer/div-zero.cpp15
-rw-r--r--test/ubsan/TestCases/Integer/incdec-overflow.cpp16
-rw-r--r--test/ubsan/TestCases/Integer/mul-overflow.cpp14
-rw-r--r--test/ubsan/TestCases/Integer/negate-overflow.cpp16
-rw-r--r--test/ubsan/TestCases/Integer/no-recover.cpp26
-rw-r--r--test/ubsan/TestCases/Integer/shift.cpp45
-rw-r--r--test/ubsan/TestCases/Integer/sub-overflow.cpp31
-rw-r--r--test/ubsan/TestCases/Integer/summary.cpp13
-rw-r--r--test/ubsan/TestCases/Integer/suppressions.cpp39
-rw-r--r--test/ubsan/TestCases/Integer/uadd-overflow.cpp32
-rw-r--r--test/ubsan/TestCases/Integer/uincdec-overflow.cpp16
-rw-r--r--test/ubsan/TestCases/Integer/umul-overflow.cpp19
-rw-r--r--test/ubsan/TestCases/Integer/usub-overflow.cpp31
-rw-r--r--test/ubsan/TestCases/Misc/Inputs/no-interception-dso.c3
-rw-r--r--test/ubsan/TestCases/Misc/Inputs/returns-unexpectedly.c1
-rw-r--r--test/ubsan/TestCases/Misc/Linux/lit.local.cfg9
-rw-r--r--test/ubsan/TestCases/Misc/Linux/print_stack_trace.cc23
-rw-r--r--test/ubsan/TestCases/Misc/Linux/ubsan_options.cc18
-rw-r--r--test/ubsan/TestCases/Misc/bool.cpp13
-rw-r--r--test/ubsan/TestCases/Misc/bool.m14
-rw-r--r--test/ubsan/TestCases/Misc/bounds.cpp31
-rw-r--r--test/ubsan/TestCases/Misc/builtins.cpp35
-rw-r--r--test/ubsan/TestCases/Misc/coverage-levels.cc48
-rw-r--r--test/ubsan/TestCases/Misc/deduplication.cpp26
-rw-r--r--test/ubsan/TestCases/Misc/enum.cpp21
-rw-r--r--test/ubsan/TestCases/Misc/log-path_test.cc38
-rw-r--r--test/ubsan/TestCases/Misc/missing_return.cpp14
-rw-r--r--test/ubsan/TestCases/Misc/monitor.cpp44
-rw-r--r--test/ubsan/TestCases/Misc/no-interception.cpp20
-rw-r--r--test/ubsan/TestCases/Misc/nonnull-arg.cpp61
-rw-r--r--test/ubsan/TestCases/Misc/nonnull.cpp42
-rw-r--r--test/ubsan/TestCases/Misc/nullability.c62
-rw-r--r--test/ubsan/TestCases/Misc/unreachable.cpp25
-rw-r--r--test/ubsan/TestCases/Misc/vla.c11
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-lvalue.cpp36
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-paramvar.cpp30
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function-variable.cpp33
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function.cpp29
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp28
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function.cpp28
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-blacklist.cpp20
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params-variable.cpp27
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params.cpp23
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-two-params.cpp23
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-openmp.cpp28
-rw-r--r--test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp17
-rw-r--r--test/ubsan/TestCases/Pointer/index-overflow.cpp19
-rw-r--r--test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp20
-rw-r--r--test/ubsan/TestCases/TypeCheck/Function/function.cpp75
-rw-r--r--test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg3
-rw-r--r--test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp50
-rw-r--r--test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg9
-rw-r--r--test/ubsan/TestCases/TypeCheck/PR33221.cpp29
-rw-r--r--test/ubsan/TestCases/TypeCheck/misaligned.cpp102
-rw-r--r--test/ubsan/TestCases/TypeCheck/null.cpp58
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp41
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp27
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp14
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp21
-rw-r--r--test/ubsan/TestCases/TypeCheck/vptr.cpp256
77 files changed, 0 insertions, 4324 deletions
diff --git a/test/ubsan/TestCases/Float/cast-overflow.cpp b/test/ubsan/TestCases/Float/cast-overflow.cpp
deleted file mode 100644
index 460150aa3b2e..000000000000
--- a/test/ubsan/TestCases/Float/cast-overflow.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-// RUN: %clangxx -fsanitize=float-cast-overflow %s -o %t
-// RUN: %run %t _
-// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0
-// RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-1
-// RUN: %run %t 2 2>&1 | FileCheck %s --check-prefix=CHECK-2
-// RUN: %run %t 3 2>&1 | FileCheck %s --check-prefix=CHECK-3
-// RUN: %run %t 4 2>&1 | FileCheck %s --check-prefix=CHECK-4
-// RUN: %run %t 5 2>&1 | FileCheck %s --check-prefix=CHECK-5
-// RUN: %run %t 6 2>&1 | FileCheck %s --check-prefix=CHECK-6
-// FIXME: %run %t 7 2>&1 | FileCheck %s --check-prefix=CHECK-7
-// FIXME: not %run %t 8 2>&1 | FileCheck %s --check-prefix=CHECK-8
-// RUN: not %run %t 9 2>&1 | FileCheck %s --check-prefix=CHECK-9
-
-// This test assumes float and double are IEEE-754 single- and double-precision.
-
-#if defined(__APPLE__)
-# include <machine/endian.h>
-# define BYTE_ORDER __DARWIN_BYTE_ORDER
-# define BIG_ENDIAN __DARWIN_BIG_ENDIAN
-# define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
-# include <sys/endian.h>
-# ifndef BYTE_ORDER
-# define BYTE_ORDER _BYTE_ORDER
-# endif
-# ifndef BIG_ENDIAN
-# define BIG_ENDIAN _BIG_ENDIAN
-# endif
-# ifndef LITTLE_ENDIAN
-# define LITTLE_ENDIAN _LITTLE_ENDIAN
-# endif
-#elif defined(__sun__) && defined(__svr4__)
-// Solaris provides _BIG_ENDIAN/_LITTLE_ENDIAN selector in sys/types.h.
-# include <sys/types.h>
-# define BIG_ENDIAN 4321
-# define LITTLE_ENDIAN 1234
-# if defined(_BIG_ENDIAN)
-# define BYTE_ORDER BIG_ENDIAN
-# else
-# define BYTE_ORDER LITTLE_ENDIAN
-# endif
-#elif defined(_WIN32)
-# define BYTE_ORDER 0
-# define BIG_ENDIAN 1
-# define LITTLE_ENDIAN 0
-#else
-# include <endian.h>
-# define BYTE_ORDER __BYTE_ORDER
-# define BIG_ENDIAN __BIG_ENDIAN
-# define LITTLE_ENDIAN __LITTLE_ENDIAN
-#endif // __APPLE__
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-
-float Inf;
-float NaN;
-
-int main(int argc, char **argv) {
- float MaxFloatRepresentableAsInt = 0x7fffff80;
- (int)MaxFloatRepresentableAsInt; // ok
- (int)-MaxFloatRepresentableAsInt; // ok
-
- float MinFloatRepresentableAsInt = -0x7fffffff - 1;
- (int)MinFloatRepresentableAsInt; // ok
-
- float MaxFloatRepresentableAsUInt = 0xffffff00u;
- (unsigned int)MaxFloatRepresentableAsUInt; // ok
-
-#ifdef __SIZEOF_INT128__
- unsigned __int128 FloatMaxAsUInt128 = -((unsigned __int128)1 << 104);
- (void)(float)FloatMaxAsUInt128; // ok
-#endif
-
- float NearlyMinusOne = -0.99999;
- unsigned Zero = NearlyMinusOne; // ok
-
- // Build a '+Inf'.
-#if BYTE_ORDER == LITTLE_ENDIAN
- unsigned char InfVal[] = { 0x00, 0x00, 0x80, 0x7f };
-#else
- unsigned char InfVal[] = { 0x7f, 0x80, 0x00, 0x00 };
-#endif
- float Inf;
- memcpy(&Inf, InfVal, 4);
-
- // Build a 'NaN'.
-#if BYTE_ORDER == LITTLE_ENDIAN
- unsigned char NaNVal[] = { 0x01, 0x00, 0x80, 0x7f };
-#else
- unsigned char NaNVal[] = { 0x7f, 0x80, 0x00, 0x01 };
-#endif
- float NaN;
- memcpy(&NaN, NaNVal, 4);
-
- double DblInf = (double)Inf; // ok
-
- switch (argv[1][0]) {
- // FIXME: Produce a source location for these checks and test for it here.
-
- // Floating point -> integer overflow.
- case '0': {
- // Note that values between 0x7ffffe00 and 0x80000000 may or may not
- // successfully round-trip, depending on the rounding mode.
- // CHECK-0: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: 2.14748{{.*}} is outside the range of representable values of type 'int'
- static int test_int = MaxFloatRepresentableAsInt + 0x80;
- // CHECK-0: SUMMARY: {{.*}}Sanitizer: float-cast-overflow {{.*}}cast-overflow.cpp:[[@LINE-1]]
- return 0;
- }
- case '1': {
- // CHECK-1: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: -2.14748{{.*}} is outside the range of representable values of type 'int'
- static int test_int = MinFloatRepresentableAsInt - 0x100;
- return 0;
- }
- case '2': {
- // CHECK-2: {{.*}}cast-overflow.cpp:[[@LINE+2]]:37: runtime error: -1 is outside the range of representable values of type 'unsigned int'
- volatile float f = -1.0;
- volatile unsigned u = (unsigned)f;
- return 0;
- }
- case '3': {
- // CHECK-3: {{.*}}cast-overflow.cpp:[[@LINE+1]]:37: runtime error: 4.2949{{.*}} is outside the range of representable values of type 'unsigned int'
- static int test_int = (unsigned)(MaxFloatRepresentableAsUInt + 0x100);
- return 0;
- }
-
- case '4': {
- // CHECK-4: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: {{.*}} is outside the range of representable values of type 'int'
- static int test_int = Inf;
- return 0;
- }
- case '5': {
- // CHECK-5: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: {{.*}} is outside the range of representable values of type 'int'
- static int test_int = NaN;
- return 0;
- }
-
- // Integer -> floating point overflow.
- case '6': {
- // CHECK-6: cast-overflow.cpp:[[@LINE+2]]:{{34: runtime error: 0xffffff00000000000000000000000001 is outside the range of representable values of type 'float'| __int128 not supported}}
-#if defined(__SIZEOF_INT128__) && !defined(_WIN32)
- static int test_int = (float)(FloatMaxAsUInt128 + 1);
- return 0;
-#else
- // Print the same line as the check above. That way the test is robust to
- // line changes around it
- printf("%s:%d: __int128 not supported", __FILE__, __LINE__ - 5);
- return 0;
-#endif
- }
- // FIXME: The backend cannot lower __fp16 operations on x86 yet.
- //case '7':
- // (__fp16)65504; // ok
- // // CHECK-7: runtime error: 65505 is outside the range of representable values of type '__fp16'
- // return (__fp16)65505;
-
- // Floating point -> floating point overflow.
- case '8':
- // CHECK-8: {{.*}}cast-overflow.cpp:[[@LINE+1]]:19: runtime error: 1e+39 is outside the range of representable values of type 'float'
- return (float)1e39;
- case '9':
- volatile long double ld = 300.0;
- // CHECK-9: {{.*}}cast-overflow.cpp:[[@LINE+1]]:14: runtime error: 300 is outside the range of representable values of type 'char'
- char c = ld;
- return c;
- }
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/integer-arithmetic-value-change.c b/test/ubsan/TestCases/ImplicitConversion/integer-arithmetic-value-change.c
deleted file mode 100644
index ef06fbf8398d..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/integer-arithmetic-value-change.c
+++ /dev/null
@@ -1,345 +0,0 @@
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c -fsanitize=implicit-integer-arithmetic-value-change %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c++ -fsanitize=implicit-integer-arithmetic-value-change %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-#include <stdint.h>
-
-// Test plan:
-// * Two types - int and char
-// * Two signs - signed and unsigned
-// * Square that - we have input and output types.
-// Thus, there are total of (2*2)^2 == 16 tests.
-// These are all the possible variations/combinations of casts.
-// However, not all of them should result in the check.
-// So here, we *only* check which should and which should not result in checks.
-
-uint32_t convert_unsigned_int_to_unsigned_int(uint32_t x) {
-#line 100
- return x;
-}
-
-uint8_t convert_unsigned_char_to_unsigned_char(uint8_t x) {
-#line 200
- return x;
-}
-
-int32_t convert_signed_int_to_signed_int(int32_t x) {
-#line 300
- return x;
-}
-
-int8_t convert_signed_char_to_signed_char(int8_t x) {
-#line 400
- return x;
-}
-
-uint8_t convert_unsigned_int_to_unsigned_char(uint32_t x) {
-#line 500
- return x;
-}
-
-uint32_t convert_unsigned_char_to_unsigned_int(uint8_t x) {
-#line 600
- return x;
-}
-
-int32_t convert_unsigned_char_to_signed_int(uint8_t x) {
-#line 700
- return x;
-}
-
-int32_t convert_signed_char_to_signed_int(int8_t x) {
-#line 800
- return x;
-}
-
-int32_t convert_unsigned_int_to_signed_int(uint32_t x) {
-#line 900
- return x;
-}
-
-uint32_t convert_signed_int_to_unsigned_int(int32_t x) {
-#line 1000
- return x;
-}
-
-uint8_t convert_signed_int_to_unsigned_char(int32_t x) {
-#line 1100
- return x;
-}
-
-uint8_t convert_signed_char_to_unsigned_char(int8_t x) {
-#line 1200
- return x;
-}
-
-int8_t convert_unsigned_char_to_signed_char(uint8_t x) {
-#line 1300
- return x;
-}
-
-uint32_t convert_signed_char_to_unsigned_int(int8_t x) {
-#line 1400
- return x;
-}
-
-int8_t convert_unsigned_int_to_signed_char(uint32_t x) {
-#line 1500
- return x;
-}
-
-int8_t convert_signed_int_to_signed_char(int32_t x) {
-#line 1600
- return x;
-}
-
-#line 10111 // !!!
-
-int main() {
- // No bits set.
- convert_unsigned_int_to_unsigned_int(0);
- convert_unsigned_char_to_unsigned_char(0);
- convert_signed_int_to_signed_int(0);
- convert_signed_char_to_signed_char(0);
- convert_unsigned_int_to_unsigned_char(0);
- convert_unsigned_char_to_unsigned_int(0);
- convert_unsigned_char_to_signed_int(0);
- convert_signed_char_to_signed_int(0);
- convert_unsigned_int_to_signed_int(0);
- convert_signed_int_to_unsigned_int(0);
- convert_signed_int_to_unsigned_char(0);
- convert_signed_char_to_unsigned_char(0);
- convert_unsigned_char_to_signed_char(0);
- convert_signed_char_to_unsigned_int(0);
- convert_unsigned_int_to_signed_char(0);
- convert_signed_int_to_signed_char(0);
-
- // One lowest bit set.
- convert_unsigned_int_to_unsigned_int(1);
- convert_unsigned_char_to_unsigned_char(1);
- convert_signed_int_to_signed_int(1);
- convert_signed_char_to_signed_char(1);
- convert_unsigned_int_to_unsigned_char(1);
- convert_unsigned_char_to_unsigned_int(1);
- convert_unsigned_char_to_signed_int(1);
- convert_signed_char_to_signed_int(1);
- convert_unsigned_int_to_signed_int(1);
- convert_signed_int_to_unsigned_int(1);
- convert_signed_int_to_unsigned_char(1);
- convert_signed_char_to_unsigned_char(1);
- convert_unsigned_char_to_signed_char(1);
- convert_signed_char_to_unsigned_int(1);
- convert_unsigned_int_to_signed_char(1);
- convert_signed_int_to_signed_char(1);
-
-#if defined(V0)
- // All source bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -1 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT32_MAX);
-#elif defined(V1)
- // Source 'Sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
-#elif defined(V2)
- // All bits except the source 'Sign' bit are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-arithmetic-value-change.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V3)
- // All destination bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-arithmetic-value-change.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-arithmetic-value-change.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-arithmetic-value-change.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 255 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 255 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V4)
- // Destination 'sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-arithmetic-value-change.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-arithmetic-value-change.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-arithmetic-value-change.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 128 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 128 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V5)
- // All bits except the destination 'sign' bit are set.
- convert_unsigned_int_to_unsigned_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -129 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967167 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#elif defined(V6)
- // Only the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN));
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)INT32_MIN);
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V7)
- // All bits except the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN))));
-// CHECK-V7: {{.*}}integer-arithmetic-value-change.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-arithmetic-value-change.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-arithmetic-value-change.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#else
-#error Some V* needs to be defined!
-#endif
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/integer-conversion.c b/test/ubsan/TestCases/ImplicitConversion/integer-conversion.c
deleted file mode 100644
index 5c1530a63786..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/integer-conversion.c
+++ /dev/null
@@ -1,351 +0,0 @@
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c -fsanitize=implicit-conversion %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c++ -fsanitize=implicit-conversion %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-#include <stdint.h>
-
-// Test plan:
-// * Two types - int and char
-// * Two signs - signed and unsigned
-// * Square that - we have input and output types.
-// Thus, there are total of (2*2)^2 == 16 tests.
-// These are all the possible variations/combinations of casts.
-// However, not all of them should result in the check.
-// So here, we *only* check which should and which should not result in checks.
-
-uint32_t convert_unsigned_int_to_unsigned_int(uint32_t x) {
-#line 100
- return x;
-}
-
-uint8_t convert_unsigned_char_to_unsigned_char(uint8_t x) {
-#line 200
- return x;
-}
-
-int32_t convert_signed_int_to_signed_int(int32_t x) {
-#line 300
- return x;
-}
-
-int8_t convert_signed_char_to_signed_char(int8_t x) {
-#line 400
- return x;
-}
-
-uint8_t convert_unsigned_int_to_unsigned_char(uint32_t x) {
-#line 500
- return x;
-}
-
-uint32_t convert_unsigned_char_to_unsigned_int(uint8_t x) {
-#line 600
- return x;
-}
-
-int32_t convert_unsigned_char_to_signed_int(uint8_t x) {
-#line 700
- return x;
-}
-
-int32_t convert_signed_char_to_signed_int(int8_t x) {
-#line 800
- return x;
-}
-
-int32_t convert_unsigned_int_to_signed_int(uint32_t x) {
-#line 900
- return x;
-}
-
-uint32_t convert_signed_int_to_unsigned_int(int32_t x) {
-#line 1000
- return x;
-}
-
-uint8_t convert_signed_int_to_unsigned_char(int32_t x) {
-#line 1100
- return x;
-}
-
-uint8_t convert_signed_char_to_unsigned_char(int8_t x) {
-#line 1200
- return x;
-}
-
-int8_t convert_unsigned_char_to_signed_char(uint8_t x) {
-#line 1300
- return x;
-}
-
-uint32_t convert_signed_char_to_unsigned_int(int8_t x) {
-#line 1400
- return x;
-}
-
-int8_t convert_unsigned_int_to_signed_char(uint32_t x) {
-#line 1500
- return x;
-}
-
-int8_t convert_signed_int_to_signed_char(int32_t x) {
-#line 1600
- return x;
-}
-
-#line 10111 // !!!
-
-int main() {
- // No bits set.
- convert_unsigned_int_to_unsigned_int(0);
- convert_unsigned_char_to_unsigned_char(0);
- convert_signed_int_to_signed_int(0);
- convert_signed_char_to_signed_char(0);
- convert_unsigned_int_to_unsigned_char(0);
- convert_unsigned_char_to_unsigned_int(0);
- convert_unsigned_char_to_signed_int(0);
- convert_signed_char_to_signed_int(0);
- convert_unsigned_int_to_signed_int(0);
- convert_signed_int_to_unsigned_int(0);
- convert_signed_int_to_unsigned_char(0);
- convert_signed_char_to_unsigned_char(0);
- convert_unsigned_char_to_signed_char(0);
- convert_signed_char_to_unsigned_int(0);
- convert_unsigned_int_to_signed_char(0);
- convert_signed_int_to_signed_char(0);
-
- // One lowest bit set.
- convert_unsigned_int_to_unsigned_int(1);
- convert_unsigned_char_to_unsigned_char(1);
- convert_signed_int_to_signed_int(1);
- convert_signed_char_to_signed_char(1);
- convert_unsigned_int_to_unsigned_char(1);
- convert_unsigned_char_to_unsigned_int(1);
- convert_unsigned_char_to_signed_int(1);
- convert_signed_char_to_signed_int(1);
- convert_unsigned_int_to_signed_int(1);
- convert_signed_int_to_unsigned_int(1);
- convert_signed_int_to_unsigned_char(1);
- convert_signed_char_to_unsigned_char(1);
- convert_unsigned_char_to_signed_char(1);
- convert_signed_char_to_unsigned_int(1);
- convert_unsigned_int_to_signed_char(1);
- convert_signed_int_to_signed_char(1);
-
-#if defined(V0)
- // All source bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -1 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT32_MAX);
-#elif defined(V1)
- // Source 'Sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
-#elif defined(V2)
- // All bits except the source 'Sign' bit are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-conversion.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-conversion.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V3)
- // All destination bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-conversion.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-conversion.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-conversion.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 255 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 255 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V4)
- // Destination 'sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-conversion.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-conversion.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-conversion.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 128 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 128 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V5)
- // All bits except the destination 'sign' bit are set.
- convert_unsigned_int_to_unsigned_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-conversion.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-conversion.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -129 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-conversion.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967167 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-conversion.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V5: {{.*}}integer-conversion.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
-// CHECK-V5: {{.*}}integer-conversion.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
-// CHECK-V5: {{.*}}integer-conversion.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#elif defined(V6)
- // Only the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN));
-// CHECK-V6: {{.*}}integer-conversion.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V6: {{.*}}integer-conversion.c:900:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- convert_signed_int_to_unsigned_int((int32_t)INT32_MIN);
-// CHECK-V6: {{.*}}integer-conversion.c:1000:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- convert_signed_int_to_unsigned_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-conversion.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-conversion.c:1200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-conversion.c:1300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-conversion.c:1400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- convert_unsigned_int_to_signed_char((((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V7)
- // All bits except the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-conversion.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN))));
-// CHECK-V7: {{.*}}integer-conversion.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-conversion.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-conversion.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#else
-#error Some V* needs to be defined!
-#endif
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/integer-sign-change-blacklist.c b/test/ubsan/TestCases/ImplicitConversion/integer-sign-change-blacklist.c
deleted file mode 100644
index a3a745e5fbf6..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/integer-sign-change-blacklist.c
+++ /dev/null
@@ -1,28 +0,0 @@
-// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
-// I'm not sure this is actually *that* issue, but this seems oddly similar to the other XFAIL'ed cases.
-// XFAIL: android
-// UNSUPPORTED: ios
-
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-integer-sign-change]" >> %tmp
-// RUN: echo "fun:implicitSignChange" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-sign-change -fno-sanitize-recover=implicit-integer-sign-change -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-#include <stdint.h>
-
-int32_t implicitSignChange(uint32_t argc) {
- return argc; // BOOM
-// CHECK: {{.*}}integer-sign-change-blacklist.c:[[@LINE-1]]:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -1 (32-bit, signed)
-}
-
-int main(int argc, char **argv) {
- return implicitSignChange(~0U);
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/integer-sign-change-summary.cpp b/test/ubsan/TestCases/ImplicitConversion/integer-sign-change-summary.cpp
deleted file mode 100644
index 7cdc4c5a1b97..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/integer-sign-change-summary.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -fsanitize=implicit-integer-sign-change %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
-// REQUIRES: !ubsan-standalone && !ubsan-standalone-static
-
-#include <stdint.h>
-
-int main() {
- int32_t t0 = (~(uint32_t(0)));
- // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:16
- // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-sign-change {{.*}}summary.cpp:[[@LINE-2]]:16
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/integer-sign-change.c b/test/ubsan/TestCases/ImplicitConversion/integer-sign-change.c
deleted file mode 100644
index 192c69ade1d5..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/integer-sign-change.c
+++ /dev/null
@@ -1,297 +0,0 @@
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c -fsanitize=implicit-integer-sign-change %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c++ -fsanitize=implicit-integer-sign-change %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-
-#include <stdint.h>
-
-// Test plan:
-// * Two types - int and char
-// * Two signs - signed and unsigned
-// * Square that - we have input and output types.
-// Thus, there are total of (2*2)^2 == 16 tests.
-// These are all the possible variations/combinations of casts.
-// However, not all of them should result in the check.
-// So here, we *only* check which should and which should not result in checks.
-
-//============================================================================//
-// Half of the cases do not need the check. //
-//============================================================================//
-
-uint32_t negative0_convert_unsigned_int_to_unsigned_int(uint32_t x) {
- return x;
-}
-
-uint8_t negative1_convert_unsigned_char_to_unsigned_char(uint8_t x) {
- return x;
-}
-
-int32_t negative2_convert_signed_int_to_signed_int(int32_t x) {
- return x;
-}
-
-int8_t negative3_convert_signed_char_to_signed_char(int8_t x) {
- return x;
-}
-
-uint8_t negative4_convert_unsigned_int_to_unsigned_char(uint32_t x) {
- return x;
-}
-
-uint32_t negative5_convert_unsigned_char_to_unsigned_int(uint8_t x) {
- return x;
-}
-
-int32_t negative6_convert_unsigned_char_to_signed_int(uint8_t x) {
- return x;
-}
-
-int32_t negative7_convert_signed_char_to_signed_int(int8_t x) {
- return x;
-}
-
-void test_negatives() {
- // No bits set.
- negative0_convert_unsigned_int_to_unsigned_int(0);
- negative1_convert_unsigned_char_to_unsigned_char(0);
- negative2_convert_signed_int_to_signed_int(0);
- negative3_convert_signed_char_to_signed_char(0);
- negative4_convert_unsigned_int_to_unsigned_char(0);
- negative5_convert_unsigned_char_to_unsigned_int(0);
- negative6_convert_unsigned_char_to_signed_int(0);
- negative7_convert_signed_char_to_signed_int(0);
-
- // One lowest bit set.
- negative0_convert_unsigned_int_to_unsigned_int(1);
- negative1_convert_unsigned_char_to_unsigned_char(1);
- negative2_convert_signed_int_to_signed_int(1);
- negative3_convert_signed_char_to_signed_char(1);
- negative4_convert_unsigned_int_to_unsigned_char(1);
- negative5_convert_unsigned_char_to_unsigned_int(1);
- negative6_convert_unsigned_char_to_signed_int(1);
- negative7_convert_signed_char_to_signed_int(1);
-
- // All source bits set.
- negative0_convert_unsigned_int_to_unsigned_int((uint32_t)UINT32_MAX);
- negative1_convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- negative2_convert_signed_int_to_signed_int((int32_t)INT32_MAX);
- negative3_convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- negative4_convert_unsigned_int_to_unsigned_char((uint32_t)UINT32_MAX);
- negative5_convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- negative6_convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- negative7_convert_signed_char_to_signed_int((int8_t)INT8_MAX);
-
- // Source 'sign' bit set.
- negative0_convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- negative1_convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- negative2_convert_signed_int_to_signed_int((int32_t)INT32_MIN);
- negative3_convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- negative4_convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MIN);
- negative5_convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- negative6_convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- negative7_convert_signed_char_to_signed_int((int8_t)INT8_MIN);
-}
-
-//============================================================================//
-// The remaining 8 cases *do* need the check. //
-//============================================================================//
-
-int32_t positive0_convert_unsigned_int_to_signed_int(uint32_t x) {
-#line 100
- return x;
-}
-
-uint32_t positive1_convert_signed_int_to_unsigned_int(int32_t x) {
-#line 200
- return x;
-}
-
-uint8_t positive2_convert_signed_int_to_unsigned_char(int32_t x) {
-#line 300
- return x;
-}
-
-uint8_t positive3_convert_signed_char_to_unsigned_char(int8_t x) {
-#line 400
- return x;
-}
-
-int8_t positive4_convert_unsigned_char_to_signed_char(uint8_t x) {
-#line 500
- return x;
-}
-
-uint32_t positive5_convert_signed_char_to_unsigned_int(int8_t x) {
-#line 600
- return x;
-}
-
-int8_t positive6_convert_unsigned_int_to_signed_char(uint32_t x) {
-#line 700
- return x;
-}
-
-int8_t positive7_convert_signed_int_to_signed_char(int32_t x) {
-#line 800
- return x;
-}
-
-#line 1120 // !!!
-
-void test_positives() {
- // No bits set.
- positive0_convert_unsigned_int_to_signed_int(0);
- positive1_convert_signed_int_to_unsigned_int(0);
- positive2_convert_signed_int_to_unsigned_char(0);
- positive3_convert_signed_char_to_unsigned_char(0);
- positive4_convert_unsigned_char_to_signed_char(0);
- positive5_convert_signed_char_to_unsigned_int(0);
- positive6_convert_unsigned_int_to_signed_char(0);
- positive7_convert_signed_int_to_signed_char(0);
-
- // One lowest bit set.
- positive0_convert_unsigned_int_to_signed_int(1);
- positive1_convert_signed_int_to_unsigned_int(1);
- positive2_convert_signed_int_to_unsigned_char(1);
- positive3_convert_signed_char_to_unsigned_char(1);
- positive4_convert_unsigned_char_to_signed_char(1);
- positive5_convert_signed_char_to_unsigned_int(1);
- positive6_convert_unsigned_int_to_signed_char(1);
- positive7_convert_signed_int_to_signed_char(1);
-
-#if defined(V0)
- // All source bits set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -1 (32-bit, signed)
- positive1_convert_signed_int_to_unsigned_int((int32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- positive2_convert_signed_int_to_unsigned_char((int32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- positive3_convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- positive4_convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- positive5_convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- positive6_convert_unsigned_int_to_signed_char((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-sign-change.c:700:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- positive7_convert_signed_int_to_signed_char((int32_t)UINT32_MAX);
-#elif defined(V1)
- // Source 'Sign' bit set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- positive1_convert_signed_int_to_unsigned_int((int32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- positive2_convert_signed_int_to_unsigned_char((int32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- positive3_convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- positive4_convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- positive5_convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- positive6_convert_unsigned_int_to_signed_char((uint32_t)INT32_MIN);
- positive7_convert_signed_int_to_signed_char((int32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-sign-change.c:800:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
-#elif defined(V2)
- // All bits except the source 'Sign' bit are set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- positive1_convert_signed_int_to_unsigned_int((int32_t)INT32_MAX);
- positive2_convert_signed_int_to_unsigned_char((int32_t)INT32_MAX);
- positive3_convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- positive4_convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- positive5_convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- positive6_convert_unsigned_int_to_signed_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-sign-change.c:700:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- positive7_convert_signed_int_to_signed_char((int32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-sign-change.c:800:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V3)
- // All destination bits set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -1 (32-bit, signed)
- positive1_convert_signed_int_to_unsigned_int((int32_t)UINT32_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- positive2_convert_signed_int_to_unsigned_char((int32_t)UINT8_MAX);
- positive3_convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- positive4_convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 255 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- positive5_convert_signed_char_to_unsigned_int((int8_t)UINT32_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -1 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967295 (32-bit, unsigned)
- positive6_convert_unsigned_int_to_signed_char((uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:700:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 255 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- positive7_convert_signed_int_to_signed_char((int32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-sign-change.c:800:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 255 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V4)
- // Destination 'sign' bit set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V4: {{.*}}integer-sign-change.c:100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- positive1_convert_signed_int_to_unsigned_int((int32_t)INT32_MIN);
-// CHECK-V4: {{.*}}integer-sign-change.c:200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- positive2_convert_signed_int_to_unsigned_char((int32_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-sign-change.c:300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -128 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- positive3_convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-sign-change.c:400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- positive4_convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-sign-change.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- positive5_convert_signed_char_to_unsigned_int((int8_t)INT32_MIN);
- positive6_convert_unsigned_int_to_signed_char((uint32_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-sign-change.c:700:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967168 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- positive7_convert_signed_int_to_signed_char((int32_t)INT8_MIN);
-#elif defined(V5)
- // All bits except the destination 'sign' bit are set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V5: {{.*}}integer-sign-change.c:100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- positive1_convert_signed_int_to_unsigned_int((int32_t)INT32_MIN);
-// CHECK-V5: {{.*}}integer-sign-change.c:200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- positive2_convert_signed_int_to_unsigned_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-sign-change.c:300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- positive3_convert_signed_char_to_unsigned_char((int8_t)(INT8_MIN));
-// CHECK-V5: {{.*}}integer-sign-change.c:400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- positive4_convert_unsigned_char_to_signed_char((uint8_t)(INT8_MIN));
-// CHECK-V5: {{.*}}integer-sign-change.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- positive5_convert_signed_char_to_unsigned_int((int8_t)(INT32_MIN));
- positive6_convert_unsigned_int_to_signed_char(~((uint32_t)(uint8_t)INT8_MIN));
- positive7_convert_signed_int_to_signed_char((int32_t)(~((uint32_t)((uint8_t)INT8_MIN))));
-// CHECK-V5: {{.*}}integer-sign-change.c:800:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#elif defined(V6)
- // Only the source and destination sign bits are set.
- positive0_convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
-// CHECK-V6: {{.*}}integer-sign-change.c:100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'int') changed the value to -2147483648 (32-bit, signed)
- positive1_convert_signed_int_to_unsigned_int((int32_t)INT32_MIN);
-// CHECK-V6: {{.*}}integer-sign-change.c:200:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 2147483648 (32-bit, unsigned)
- positive2_convert_signed_int_to_unsigned_char((int32_t)((uint32_t)INT32_MIN | (uint32_t)((uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-sign-change.c:300:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- positive3_convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-sign-change.c:400:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- positive4_convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-sign-change.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- positive5_convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
-// CHECK-V6: {{.*}}integer-sign-change.c:600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'signed char') of value -128 (8-bit, signed) to type '{{.*}}' (aka 'unsigned int') changed the value to 4294967168 (32-bit, unsigned)
- positive6_convert_unsigned_int_to_signed_char((uint32_t)((uint32_t)INT32_MIN | (uint32_t)((uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-sign-change.c:700:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- positive7_convert_signed_int_to_signed_char((int32_t)((uint32_t)INT32_MIN | (uint32_t)((uint8_t)INT8_MIN)));
-#else
-#error Some V* needs to be defined!
-#endif
-}
-
-// CHECK-NOT: implicit conversion
-
-int main() {
- test_negatives();
- test_positives();
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/integer-truncation.c b/test/ubsan/TestCases/ImplicitConversion/integer-truncation.c
deleted file mode 100644
index 157564871e45..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/integer-truncation.c
+++ /dev/null
@@ -1,324 +0,0 @@
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c -fsanitize=implicit-integer-truncation %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c++ -fsanitize=implicit-integer-truncation %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-#include <stdint.h>
-
-// Test plan:
-// * Two types - int and char
-// * Two signs - signed and unsigned
-// * Square that - we have input and output types.
-// Thus, there are total of (2*2)^2 == 16 tests.
-// These are all the possible variations/combinations of casts.
-// However, not all of them should result in the check.
-// So here, we *only* check which should and which should not result in checks.
-
-uint32_t convert_unsigned_int_to_unsigned_int(uint32_t x) {
-#line 100
- return x;
-}
-
-uint8_t convert_unsigned_char_to_unsigned_char(uint8_t x) {
-#line 200
- return x;
-}
-
-int32_t convert_signed_int_to_signed_int(int32_t x) {
-#line 300
- return x;
-}
-
-int8_t convert_signed_char_to_signed_char(int8_t x) {
-#line 400
- return x;
-}
-
-uint8_t convert_unsigned_int_to_unsigned_char(uint32_t x) {
-#line 500
- return x;
-}
-
-uint32_t convert_unsigned_char_to_unsigned_int(uint8_t x) {
-#line 600
- return x;
-}
-
-int32_t convert_unsigned_char_to_signed_int(uint8_t x) {
-#line 700
- return x;
-}
-
-int32_t convert_signed_char_to_signed_int(int8_t x) {
-#line 800
- return x;
-}
-
-int32_t convert_unsigned_int_to_signed_int(uint32_t x) {
-#line 900
- return x;
-}
-
-uint32_t convert_signed_int_to_unsigned_int(int32_t x) {
-#line 1000
- return x;
-}
-
-uint8_t convert_signed_int_to_unsigned_char(int32_t x) {
-#line 1100
- return x;
-}
-
-uint8_t convert_signed_char_to_unsigned_char(int8_t x) {
-#line 1200
- return x;
-}
-
-int8_t convert_unsigned_char_to_signed_char(uint8_t x) {
-#line 1300
- return x;
-}
-
-uint32_t convert_signed_char_to_unsigned_int(int8_t x) {
-#line 1400
- return x;
-}
-
-int8_t convert_unsigned_int_to_signed_char(uint32_t x) {
-#line 1500
- return x;
-}
-
-int8_t convert_signed_int_to_signed_char(int32_t x) {
-#line 1600
- return x;
-}
-
-#line 1111 // !!!
-
-int main() {
- // No bits set.
- convert_unsigned_int_to_unsigned_int(0);
- convert_unsigned_char_to_unsigned_char(0);
- convert_signed_int_to_signed_int(0);
- convert_signed_char_to_signed_char(0);
- convert_unsigned_int_to_unsigned_char(0);
- convert_unsigned_char_to_unsigned_int(0);
- convert_unsigned_char_to_signed_int(0);
- convert_signed_char_to_signed_int(0);
- convert_unsigned_int_to_signed_int(0);
- convert_signed_int_to_unsigned_int(0);
- convert_signed_int_to_unsigned_char(0);
- convert_signed_char_to_unsigned_char(0);
- convert_unsigned_char_to_signed_char(0);
- convert_signed_char_to_unsigned_int(0);
- convert_unsigned_int_to_signed_char(0);
- convert_signed_int_to_signed_char(0);
-
- // One lowest bit set.
- convert_unsigned_int_to_unsigned_int(1);
- convert_unsigned_char_to_unsigned_char(1);
- convert_signed_int_to_signed_int(1);
- convert_signed_char_to_signed_char(1);
- convert_unsigned_int_to_unsigned_char(1);
- convert_unsigned_char_to_unsigned_int(1);
- convert_unsigned_char_to_signed_int(1);
- convert_signed_char_to_signed_int(1);
- convert_unsigned_int_to_signed_int(1);
- convert_signed_int_to_unsigned_int(1);
- convert_signed_int_to_unsigned_char(1);
- convert_signed_char_to_unsigned_char(1);
- convert_unsigned_char_to_signed_char(1);
- convert_signed_char_to_unsigned_int(1);
- convert_unsigned_int_to_signed_char(1);
- convert_signed_int_to_signed_char(1);
-
-#if defined(V0)
- // All source bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)UINT32_MAX);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT32_MAX);
-#elif defined(V1)
- // Source 'Sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
-#elif defined(V2)
- // All bits except the source 'Sign' bit are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V3)
- // All destination bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 255 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 255 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V4)
- // Destination 'sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 128 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 128 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V5)
- // All bits except the destination 'sign' bit are set.
- convert_unsigned_int_to_unsigned_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_unsigned_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_unsigned_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#elif defined(V6)
- // Only the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN));
-// CHECK-V6: {{.*}}integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V7)
- // All bits except the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN))));
-// CHECK-V7: {{.*}}integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#else
-#error Some V* needs to be defined!
-#endif
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-blacklist.c b/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-blacklist.c
deleted file mode 100644
index 229f8326077a..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-blacklist.c
+++ /dev/null
@@ -1,60 +0,0 @@
-// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
-// I'm not sure this is actually *that* issue, but this seems oddly similar to the other XFAIL'ed cases.
-// XFAIL: android
-// UNSUPPORTED: ios
-
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-
-// RUN: rm -f %tmp
-// RUN: echo "[integer]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-conversion]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-signed-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-unsigned-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <stdint.h>
-
-uint8_t implicitUnsignedTruncation(int32_t argc) {
- return argc; // BOOM
-// CHECK: {{.*}}signed-integer-truncation-blacklist.c:[[@LINE-1]]:10: runtime error: implicit conversion from type '{{.*}} (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
-}
-
-int main(int argc, char **argv) {
- return implicitUnsignedTruncation(-1);
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c b/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c
deleted file mode 100644
index 0e79df0b512c..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
-// I'm not sure this is actually *that* issue, but this seems oddly similar to the other XFAIL'ed cases.
-// XFAIL: android
-// UNSUPPORTED: ios
-
-// All of these don't actually silence it:
-
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-signed-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitConversion" >> %tmp
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-signed-integer-truncation,implicit-integer-sign-change]" >> %tmp
-// RUN: echo "fun:implicitConversion" >> %tmp
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-
-
-// The only two way it works:
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-integer-sign-change]" >> %tmp
-// RUN: echo "fun:implicitConversion" >> %tmp
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-signed-integer-truncation]" >> %tmp
-// RUN: echo "[implicit-integer-sign-change]" >> %tmp
-// RUN: echo "fun:implicitConversion" >> %tmp
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fno-sanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-#include <stdint.h>
-
-int8_t implicitConversion(uint32_t argc) {
- return argc; // BOOM
-// CHECK: {{.*}}signed-integer-truncation-or-sign-change-blacklist.c:[[@LINE-1]]:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-}
-
-int main(int argc, char **argv) {
- return implicitConversion(~0U);
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-summary.cpp b/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-summary.cpp
deleted file mode 100644
index 13eaef274157..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-summary.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
-// REQUIRES: !ubsan-standalone && !ubsan-standalone-static
-
-#include <stdint.h>
-
-int main() {
- int8_t t0 = (~(uint32_t(0)));
- // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:15
- // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: implicit-signed-integer-truncation-or-sign-change {{.*}}summary.cpp:[[@LINE-2]]:15
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-summary.cpp b/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-summary.cpp
deleted file mode 100644
index 1da9e3b41e36..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-summary.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -fsanitize=implicit-signed-integer-truncation %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
-// REQUIRES: !ubsan-standalone && !ubsan-standalone-static
-
-#include <stdint.h>
-
-int main() {
- uint8_t t0 = int32_t(-1);
- // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:16
- // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: implicit-signed-integer-truncation {{.*}}summary.cpp:[[@LINE-2]]:16
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation.c b/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation.c
deleted file mode 100644
index 1ff67eb0579b..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation.c
+++ /dev/null
@@ -1,318 +0,0 @@
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c -fsanitize=implicit-signed-integer-truncation %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV3 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV4 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c++ -fsanitize=implicit-signed-integer-truncation %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-#include <stdint.h>
-
-// Test plan:
-// * Two types - int and char
-// * Two signs - signed and unsigned
-// * Square that - we have input and output types.
-// Thus, there are total of (2*2)^2 == 16 tests.
-// These are all the possible variations/combinations of casts.
-// However, not all of them should result in the check.
-// So here, we *only* check which should and which should not result in checks.
-
-uint32_t convert_unsigned_int_to_unsigned_int(uint32_t x) {
-#line 100
- return x;
-}
-
-uint8_t convert_unsigned_char_to_unsigned_char(uint8_t x) {
-#line 200
- return x;
-}
-
-int32_t convert_signed_int_to_signed_int(int32_t x) {
-#line 300
- return x;
-}
-
-int8_t convert_signed_char_to_signed_char(int8_t x) {
-#line 400
- return x;
-}
-
-uint8_t convert_unsigned_int_to_unsigned_char(uint32_t x) {
-#line 500
- return x;
-}
-
-uint32_t convert_unsigned_char_to_unsigned_int(uint8_t x) {
-#line 600
- return x;
-}
-
-int32_t convert_unsigned_char_to_signed_int(uint8_t x) {
-#line 700
- return x;
-}
-
-int32_t convert_signed_char_to_signed_int(int8_t x) {
-#line 800
- return x;
-}
-
-int32_t convert_unsigned_int_to_signed_int(uint32_t x) {
-#line 900
- return x;
-}
-
-uint32_t convert_signed_int_to_unsigned_int(int32_t x) {
-#line 1000
- return x;
-}
-
-uint8_t convert_signed_int_to_unsigned_char(int32_t x) {
-#line 1100
- return x;
-}
-
-uint8_t convert_signed_char_to_unsigned_char(int8_t x) {
-#line 1200
- return x;
-}
-
-int8_t convert_unsigned_char_to_signed_char(uint8_t x) {
-#line 1300
- return x;
-}
-
-uint32_t convert_signed_char_to_unsigned_int(int8_t x) {
-#line 1400
- return x;
-}
-
-int8_t convert_unsigned_int_to_signed_char(uint32_t x) {
-#line 1500
- return x;
-}
-
-int8_t convert_signed_int_to_signed_char(int32_t x) {
-#line 1600
- return x;
-}
-
-#line 1111 // !!!
-
-int main() {
- // No bits set.
- convert_unsigned_int_to_unsigned_int(0);
- convert_unsigned_char_to_unsigned_char(0);
- convert_signed_int_to_signed_int(0);
- convert_signed_char_to_signed_char(0);
- convert_unsigned_int_to_unsigned_char(0);
- convert_unsigned_char_to_unsigned_int(0);
- convert_unsigned_char_to_signed_int(0);
- convert_signed_char_to_signed_int(0);
- convert_unsigned_int_to_signed_int(0);
- convert_signed_int_to_unsigned_int(0);
- convert_signed_int_to_unsigned_char(0);
- convert_signed_char_to_unsigned_char(0);
- convert_unsigned_char_to_signed_char(0);
- convert_signed_char_to_unsigned_int(0);
- convert_unsigned_int_to_signed_char(0);
- convert_signed_int_to_signed_char(0);
-
- // One lowest bit set.
- convert_unsigned_int_to_unsigned_int(1);
- convert_unsigned_char_to_unsigned_char(1);
- convert_signed_int_to_signed_int(1);
- convert_signed_char_to_signed_char(1);
- convert_unsigned_int_to_unsigned_char(1);
- convert_unsigned_char_to_unsigned_int(1);
- convert_unsigned_char_to_signed_int(1);
- convert_signed_char_to_signed_int(1);
- convert_unsigned_int_to_signed_int(1);
- convert_signed_int_to_unsigned_int(1);
- convert_signed_int_to_unsigned_char(1);
- convert_signed_char_to_unsigned_char(1);
- convert_unsigned_char_to_signed_char(1);
- convert_signed_char_to_unsigned_int(1);
- convert_unsigned_int_to_signed_char(1);
- convert_signed_int_to_signed_char(1);
-
-#if defined(V0)
- // All source bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}signed-integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -1 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)UINT32_MAX);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT32_MAX);
-#elif defined(V1)
- // Source 'Sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}signed-integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483648 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 0 (8-bit, signed)
-#elif defined(V2)
- // All bits except the source 'Sign' bit are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}signed-integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483647 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V3)
- // All destination bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 255 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT8_MAX);
-// CHECK-V3: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 255 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
-#elif defined(V4)
- // Destination 'sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 128 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
-// CHECK-V4: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 128 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V5)
- // All bits except the destination 'sign' bit are set.
- convert_unsigned_int_to_unsigned_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_unsigned_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_unsigned_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}signed-integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -129 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#elif defined(V6)
- // Only the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN));
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}signed-integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V6: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value -2147483520 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to -128 (8-bit, signed)
-#elif defined(V7)
- // All bits except the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN))));
-// CHECK-V7: {{.*}}signed-integer-truncation.c:1100:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}signed-integer-truncation.c:1500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
- convert_signed_int_to_signed_char((int32_t)~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}signed-integer-truncation.c:1600:10: runtime error: implicit conversion from type '{{.*}}' (aka 'int') of value 2147483519 (32-bit, signed) to type '{{.*}}' (aka 'signed char') changed the value to 127 (8-bit, signed)
-#else
-#error Some V* needs to be defined!
-#endif
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-blacklist.c b/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-blacklist.c
deleted file mode 100644
index 938b7a8c102c..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-blacklist.c
+++ /dev/null
@@ -1,60 +0,0 @@
-// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
-// I'm not sure this is actually *that* issue, but this seems oddly similar to the other XFAIL'ed cases.
-// XFAIL: android
-// UNSUPPORTED: ios
-
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion"
-
-// RUN: rm -f %tmp
-// RUN: echo "[integer]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-conversion]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-unsigned-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | not FileCheck %s
-
-// RUN: rm -f %tmp
-// RUN: echo "[implicit-signed-integer-truncation]" >> %tmp
-// RUN: echo "fun:implicitUnsignedTruncation" >> %tmp
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clang -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation -fsanitize-blacklist=%tmp -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <stdint.h>
-
-uint8_t implicitUnsignedTruncation(uint32_t argc) {
- return argc; // BOOM
-// CHECK: {{.*}}unsigned-integer-truncation-blacklist.c:[[@LINE-1]]:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
-}
-
-int main(int argc, char **argv) {
- return implicitUnsignedTruncation(~0U);
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-summary.cpp b/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-summary.cpp
deleted file mode 100644
index 5117dc2a34f3..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation-summary.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -fsanitize=implicit-unsigned-integer-truncation %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
-// REQUIRES: !ubsan-standalone && !ubsan-standalone-static
-
-#include <stdint.h>
-
-int main() {
- uint8_t t0 = (~(uint32_t(0)));
- // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:16
- // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: implicit-unsigned-integer-truncation {{.*}}summary.cpp:[[@LINE-2]]:16
- return 0;
-}
diff --git a/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation.c b/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation.c
deleted file mode 100644
index 49d223ccda39..000000000000
--- a/test/ubsan/TestCases/ImplicitConversion/unsigned-integer-truncation.c
+++ /dev/null
@@ -1,304 +0,0 @@
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV3 -o %t && %run %t 2>&1 | not FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV4 -o %t && %run %t 2>&1 | not FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c -fsanitize=implicit-unsigned-integer-truncation %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV0 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V0
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV1 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V1
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV2 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V2
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV3 -o %t && %run %t 2>&1 | not FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V3
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV4 -o %t && %run %t 2>&1 | not FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V4
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV5 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V5
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV6 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V6
-// RUN: %clang -x c++ -fsanitize=implicit-unsigned-integer-truncation %s -DV7 -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not="implicit conversion" --check-prefixes=CHECK-V7
-
-#include <stdint.h>
-
-// Test plan:
-// * Two types - int and char
-// * Two signs - signed and unsigned
-// * Square that - we have input and output types.
-// Thus, there are total of (2*2)^2 == 16 tests.
-// These are all the possible variations/combinations of casts.
-// However, not all of them should result in the check.
-// So here, we *only* check which should and which should not result in checks.
-
-uint32_t convert_unsigned_int_to_unsigned_int(uint32_t x) {
-#line 100
- return x;
-}
-
-uint8_t convert_unsigned_char_to_unsigned_char(uint8_t x) {
-#line 200
- return x;
-}
-
-int32_t convert_signed_int_to_signed_int(int32_t x) {
-#line 300
- return x;
-}
-
-int8_t convert_signed_char_to_signed_char(int8_t x) {
-#line 400
- return x;
-}
-
-uint8_t convert_unsigned_int_to_unsigned_char(uint32_t x) {
-#line 500
- return x;
-}
-
-uint32_t convert_unsigned_char_to_unsigned_int(uint8_t x) {
-#line 600
- return x;
-}
-
-int32_t convert_unsigned_char_to_signed_int(uint8_t x) {
-#line 700
- return x;
-}
-
-int32_t convert_signed_char_to_signed_int(int8_t x) {
-#line 800
- return x;
-}
-
-int32_t convert_unsigned_int_to_signed_int(uint32_t x) {
-#line 900
- return x;
-}
-
-uint32_t convert_signed_int_to_unsigned_int(int32_t x) {
-#line 1000
- return x;
-}
-
-uint8_t convert_signed_int_to_unsigned_char(int32_t x) {
-#line 1100
- return x;
-}
-
-uint8_t convert_signed_char_to_unsigned_char(int8_t x) {
-#line 1200
- return x;
-}
-
-int8_t convert_unsigned_char_to_signed_char(uint8_t x) {
-#line 1300
- return x;
-}
-
-uint32_t convert_signed_char_to_unsigned_int(int8_t x) {
-#line 1400
- return x;
-}
-
-int8_t convert_unsigned_int_to_signed_char(uint32_t x) {
-#line 1500
- return x;
-}
-
-int8_t convert_signed_int_to_signed_char(int32_t x) {
-#line 1600
- return x;
-}
-
-#line 1111 // !!!
-
-int main() {
- // No bits set.
- convert_unsigned_int_to_unsigned_int(0);
- convert_unsigned_char_to_unsigned_char(0);
- convert_signed_int_to_signed_int(0);
- convert_signed_char_to_signed_char(0);
- convert_unsigned_int_to_unsigned_char(0);
- convert_unsigned_char_to_unsigned_int(0);
- convert_unsigned_char_to_signed_int(0);
- convert_signed_char_to_signed_int(0);
- convert_unsigned_int_to_signed_int(0);
- convert_signed_int_to_unsigned_int(0);
- convert_signed_int_to_unsigned_char(0);
- convert_signed_char_to_unsigned_char(0);
- convert_unsigned_char_to_signed_char(0);
- convert_signed_char_to_unsigned_int(0);
- convert_unsigned_int_to_signed_char(0);
- convert_signed_int_to_signed_char(0);
-
- // One lowest bit set.
- convert_unsigned_int_to_unsigned_int(1);
- convert_unsigned_char_to_unsigned_char(1);
- convert_signed_int_to_signed_int(1);
- convert_signed_char_to_signed_char(1);
- convert_unsigned_int_to_unsigned_char(1);
- convert_unsigned_char_to_unsigned_int(1);
- convert_unsigned_char_to_signed_int(1);
- convert_signed_char_to_signed_int(1);
- convert_unsigned_int_to_signed_int(1);
- convert_signed_int_to_unsigned_int(1);
- convert_signed_int_to_unsigned_char(1);
- convert_signed_char_to_unsigned_char(1);
- convert_unsigned_char_to_signed_char(1);
- convert_signed_char_to_unsigned_int(1);
- convert_unsigned_int_to_signed_char(1);
- convert_signed_int_to_signed_char(1);
-
-#if defined(V0)
- // All source bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT32_MAX);
-// CHECK-V0: {{.*}}unsigned-integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT32_MAX);
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)UINT32_MAX);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT32_MAX);
-#elif defined(V1)
- // Source 'Sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MIN);
-// CHECK-V1: {{.*}}unsigned-integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483648 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 0 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MIN);
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MIN);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MIN);
-#elif defined(V2)
- // All bits except the source 'Sign' bit are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)INT32_MAX);
-// CHECK-V2: {{.*}}unsigned-integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483647 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 255 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)INT32_MAX);
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)INT32_MAX);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)INT32_MAX);
-#elif defined(V3)
- // All destination bits set.
- convert_unsigned_int_to_unsigned_int((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)UINT8_MAX);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_signed_char((int8_t)UINT8_MAX);
- convert_unsigned_int_to_unsigned_char((uint32_t)UINT8_MAX);
- convert_unsigned_char_to_unsigned_int((uint8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)UINT8_MAX);
- convert_signed_char_to_signed_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)UINT8_MAX);
- convert_signed_char_to_unsigned_char((int8_t)UINT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)UINT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)UINT8_MAX);
- convert_unsigned_int_to_signed_char((uint32_t)UINT8_MAX);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)UINT8_MAX);
-#elif defined(V4)
- // Destination 'sign' bit set.
- convert_unsigned_int_to_unsigned_int((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((uint32_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_int((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((uint32_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_char((int32_t)(uint32_t)(uint8_t)INT8_MIN);
-#elif defined(V5)
- // All bits except the destination 'sign' bit are set.
- convert_unsigned_int_to_unsigned_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_unsigned_char_to_unsigned_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_signed_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char((~((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V5: {{.*}}unsigned-integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967167 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_unsigned_int((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_unsigned_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_unsigned_char((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)(uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)(uint8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((~((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_signed_char((int32_t)(~((uint32_t)(uint8_t)INT8_MIN)));
-#elif defined(V6)
- // Only the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MIN);
- convert_signed_int_to_signed_int((int32_t)INT32_MIN);
- convert_signed_char_to_signed_char((int8_t)INT8_MIN);
- convert_unsigned_int_to_unsigned_char(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN));
-// CHECK-V6: {{.*}}unsigned-integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483776 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 128 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MIN);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MIN);
- convert_signed_char_to_signed_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_int((uint32_t)INT32_MIN);
- convert_signed_int_to_unsigned_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_char_to_unsigned_char((int8_t)INT8_MIN);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MIN);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MIN);
- convert_unsigned_int_to_signed_char((((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_signed_char((int32_t)(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-#elif defined(V7)
- // All bits except the source and destination sign bits are set.
- convert_unsigned_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_unsigned_char_to_unsigned_char((uint8_t)INT8_MAX);
- convert_signed_int_to_signed_int((int32_t)INT32_MAX);
- convert_signed_char_to_signed_char((int8_t)INT8_MAX);
- convert_unsigned_int_to_unsigned_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-// CHECK-V7: {{.*}}unsigned-integer-truncation.c:500:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 2147483519 (32-bit, unsigned) to type '{{.*}}' (aka 'unsigned char') changed the value to 127 (8-bit, unsigned)
- convert_unsigned_char_to_unsigned_int((uint8_t)INT8_MAX);
- convert_unsigned_char_to_signed_int((uint8_t)INT8_MAX);
- convert_signed_char_to_signed_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_int((uint32_t)INT32_MAX);
- convert_signed_int_to_unsigned_char((int32_t)(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN))));
- convert_signed_char_to_unsigned_char((int8_t)INT8_MAX);
- convert_unsigned_char_to_signed_char((uint8_t)INT8_MAX);
- convert_signed_char_to_unsigned_int((int8_t)INT8_MAX);
- convert_unsigned_int_to_signed_char(~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
- convert_signed_int_to_signed_char((int32_t)~(((uint32_t)INT32_MIN) | ((uint32_t)(uint8_t)INT8_MIN)));
-#else
-#error Some V* needs to be defined!
-#endif
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Integer/add-overflow.cpp b/test/ubsan/TestCases/Integer/add-overflow.cpp
deleted file mode 100644
index 301941b852b4..000000000000
--- a/test/ubsan/TestCases/Integer/add-overflow.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// RUN: %clangxx -DADD_I32 -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I32
-// RUN: %clangxx -DADD_I64 -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I64
-// RUN: %clangxx -DADD_I128 -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I128
-
-#include <stdint.h>
-#include <stdio.h>
-
-int main() {
- // These promote to 'int'.
- (void)(int8_t(0x7f) + int8_t(0x7f));
- (void)(int16_t(0x3fff) + int16_t(0x4000));
-
-#ifdef ADD_I32
- int32_t k = 0x12345678;
- k += 0x789abcde;
- // CHECK-ADD_I32: add-overflow.cpp:[[@LINE-1]]:5: runtime error: signed integer overflow: 305419896 + 2023406814 cannot be represented in type 'int'
-#endif
-
-#ifdef ADD_I64
- (void)(int64_t(8000000000000000000ll) + int64_t(2000000000000000000ll));
- // CHECK-ADD_I64: 8000000000000000000 + 2000000000000000000 cannot be represented in type '{{long( long)?}}'
-#endif
-
-#ifdef ADD_I128
-# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
- (void)((__int128_t(1) << 126) + (__int128_t(1) << 126));
-# else
- puts("__int128 not supported");
-# endif
- // CHECK-ADD_I128: {{0x40000000000000000000000000000000 \+ 0x40000000000000000000000000000000 cannot be represented in type '__int128'|__int128 not supported}}
-#endif
-}
diff --git a/test/ubsan/TestCases/Integer/div-overflow.cpp b/test/ubsan/TestCases/Integer/div-overflow.cpp
deleted file mode 100644
index 76dd60de45ce..000000000000
--- a/test/ubsan/TestCases/Integer/div-overflow.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <stdint.h>
-
-int main() {
- unsigned(0x80000000) / -1;
-
- // CHECK: div-overflow.cpp:9:23: runtime error: division of -2147483648 by -1 cannot be represented in type 'int'
- int32_t(0x80000000) / -1;
-}
diff --git a/test/ubsan/TestCases/Integer/div-zero.cpp b/test/ubsan/TestCases/Integer/div-zero.cpp
deleted file mode 100644
index 68b01afab218..000000000000
--- a/test/ubsan/TestCases/Integer/div-zero.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=0 %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=1U %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=float-divide-by-zero -DDIVIDEND=1.5 %s -o %t && %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND='intmax(123)' %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#if defined(__SIZEOF_INT128__) && !defined(_WIN32)
-typedef __int128 intmax;
-#else
-typedef long long intmax;
-#endif
-
-int main() {
- // CHECK: div-zero.cpp:[[@LINE+1]]:12: runtime error: division by zero
- DIVIDEND / 0;
-}
diff --git a/test/ubsan/TestCases/Integer/incdec-overflow.cpp b/test/ubsan/TestCases/Integer/incdec-overflow.cpp
deleted file mode 100644
index 06090300af3b..000000000000
--- a/test/ubsan/TestCases/Integer/incdec-overflow.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clangxx -DOP=n++ -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=PLUS
-// RUN: %clangxx -DOP=++n -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=PLUS
-// RUN: %clangxx -DOP=m-- -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=MINUS
-// RUN: %clangxx -DOP=--m -fsanitize=signed-integer-overflow %s -o %t4 && %run %t4 2>&1 | FileCheck %s --check-prefix=MINUS
-
-#include <stdint.h>
-
-int main() {
- int n = 0x7ffffffd;
- n++;
- n++;
- int m = -n - 1;
- OP;
- // PLUS: incdec-overflow.cpp:[[@LINE-1]]:3: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
- // MINUS: incdec-overflow.cpp:[[@LINE-2]]:3: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
-}
diff --git a/test/ubsan/TestCases/Integer/mul-overflow.cpp b/test/ubsan/TestCases/Integer/mul-overflow.cpp
deleted file mode 100644
index 20fece5f9fe2..000000000000
--- a/test/ubsan/TestCases/Integer/mul-overflow.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <stdint.h>
-
-int main() {
- // These promote to 'int'.
- (void)(int8_t(-2) * int8_t(0x7f));
- (void)(int16_t(0x7fff) * int16_t(0x7fff));
- (void)(uint16_t(0xffff) * int16_t(0x7fff));
- (void)(uint16_t(0xffff) * uint16_t(0x8000));
-
- // CHECK: mul-overflow.cpp:13:27: runtime error: signed integer overflow: 65535 * 32769 cannot be represented in type 'int'
- (void)(uint16_t(0xffff) * uint16_t(0x8001));
-}
diff --git a/test/ubsan/TestCases/Integer/negate-overflow.cpp b/test/ubsan/TestCases/Integer/negate-overflow.cpp
deleted file mode 100644
index 5e36b9db657f..000000000000
--- a/test/ubsan/TestCases/Integer/negate-overflow.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECKS
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECKU
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t2 && %env_ubsan_opts=silence_unsigned_overflow=1 %run %t2 2>&1 | FileCheck %s --check-prefix=CHECKU-SILENT --allow-empty
-
-int main() {
- // CHECKS-NOT: runtime error
- // CHECKU: negate-overflow.cpp:[[@LINE+3]]:3: runtime error: negation of 2147483648 cannot be represented in type 'unsigned int'
- // CHECKU-NOT: cast to an unsigned
- // CHECKU-SILENT-NOT: runtime error
- -unsigned(-0x7fffffff - 1); // ok
- // CHECKS: negate-overflow.cpp:[[@LINE+2]]:3: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
- // CHECKU-NOT: runtime error
- -(-0x7fffffff - 1);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Integer/no-recover.cpp b/test/ubsan/TestCases/Integer/no-recover.cpp
deleted file mode 100644
index 45aeb9e75241..000000000000
--- a/test/ubsan/TestCases/Integer/no-recover.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=RECOVER
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all -fsanitize-recover=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=RECOVER
-// RUN: %env_ubsan_opts=silence_unsigned_overflow=1 %run %t 2>&1 | FileCheck %s --check-prefix=SILENT-RECOVER --allow-empty
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=unsigned-integer-overflow %s -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=ABORT
-// RUN: %env_ubsan_opts=silence_unsigned_overflow=1 not %run %t 2>&1 | FileCheck %s --check-prefix=ABORT
-
-#include <stdint.h>
-
-int main() {
- // These promote to 'int'.
- (void)(uint8_t(0xff) + uint8_t(0xff));
- (void)(uint16_t(0xf0fff) + uint16_t(0x0fff));
- // RECOVER-NOT: runtime error
- // ABORT-NOT: runtime error
-
- uint32_t k = 0x87654321;
- k += 0xedcba987;
- // RECOVER: no-recover.cpp:[[@LINE-1]]:5: runtime error: unsigned integer overflow: 2271560481 + 3989547399 cannot be represented in type 'unsigned int'
- // ABORT: no-recover.cpp:[[@LINE-2]]:5: runtime error: unsigned integer overflow: 2271560481 + 3989547399 cannot be represented in type 'unsigned int'
-
- (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
- // RECOVER: 10000000000000000000 + 9000000000000000000 cannot be represented in type 'unsigned {{long( long)?}}'
- // SILENT-RECOVER-NOT: runtime error
- // ABORT-NOT: runtime error
-}
diff --git a/test/ubsan/TestCases/Integer/shift.cpp b/test/ubsan/TestCases/Integer/shift.cpp
deleted file mode 100644
index 50db16dac18e..000000000000
--- a/test/ubsan/TestCases/Integer/shift.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// RUN: %clangxx -DLSH_OVERFLOW -DOP='<<' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t1 && not %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-LSH_OVERFLOW
-// RUN: %clangxx -DLSH_OVERFLOW -DOP='<<=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t2 && not %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-LSH_OVERFLOW
-// RUN: %clangxx -DTOO_LOW -DOP='<<' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t3 && not %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
-// RUN: %clangxx -DTOO_LOW -DOP='>>' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t4 && not %run %t4 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
-// RUN: %clangxx -DTOO_LOW -DOP='<<=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t5 && not %run %t5 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
-// RUN: %clangxx -DTOO_LOW -DOP='>>=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t6 && not %run %t6 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
-// RUN: %clangxx -DTOO_HIGH -DOP='<<' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t7 && not %run %t7 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
-// RUN: %clangxx -DTOO_HIGH -DOP='>>' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t8 && not %run %t8 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
-// RUN: %clangxx -DTOO_HIGH -DOP='<<=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t9 && not %run %t9 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
-// RUN: %clangxx -DTOO_HIGH -DOP='>>=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t10 && not %run %t10 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
-
-// RUN: %clangxx -DLSH_OVERFLOW -DOP='<<' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t12 && %run %t12
-// RUN: %clangxx -DLSH_OVERFLOW -DOP='>>' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t13 && %run %t13
-// RUN: %clangxx -DTOO_LOW -DOP='<<' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t14 && %run %t14
-// RUN: %clangxx -DTOO_LOW -DOP='>>' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t15 && %run %t15
-// RUN: %clangxx -DTOO_HIGH -DOP='<<' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t16 && %run %t16
-// RUN: %clangxx -DTOO_HIGH -DOP='>>' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t17 && %run %t17
-
-#include <stdint.h>
-
-int main() {
- int a = 1;
- unsigned b = 1;
-
- a <<= 31; // ok in C++11, not ok in C99/C11
- b <<= 31; // ok
- b <<= 1; // still ok, unsigned
-
-#ifdef LSH_OVERFLOW
- // CHECK-LSH_OVERFLOW: shift.cpp:[[@LINE+1]]:5: runtime error: left shift of negative value -2147483648
- a OP 1;
-#endif
-
-#ifdef TOO_LOW
- a = 0;
- // CHECK-TOO_LOW: shift.cpp:[[@LINE+1]]:5: runtime error: shift exponent -3 is negative
- a OP (-3);
-#endif
-
-#ifdef TOO_HIGH
- a = 0;
- // CHECK-TOO_HIGH: shift.cpp:[[@LINE+1]]:5: runtime error: shift exponent 32 is too large for 32-bit type 'int'
- a OP 32;
-#endif
-}
diff --git a/test/ubsan/TestCases/Integer/sub-overflow.cpp b/test/ubsan/TestCases/Integer/sub-overflow.cpp
deleted file mode 100644
index 54ec4b5cd3c6..000000000000
--- a/test/ubsan/TestCases/Integer/sub-overflow.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// RUN: %clangxx -DSUB_I32 -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I32
-// RUN: %clangxx -DSUB_I64 -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I64
-// RUN: %clangxx -DSUB_I128 -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I128
-
-#include <stdint.h>
-#include <stdio.h>
-
-int main() {
- // These promote to 'int'.
- (void)(int8_t(-2) - int8_t(0x7f));
- (void)(int16_t(-2) - int16_t(0x7fff));
-
-#ifdef SUB_I32
- (void)(int32_t(-2) - int32_t(0x7fffffff));
- // CHECK-SUB_I32: sub-overflow.cpp:[[@LINE-1]]:22: runtime error: signed integer overflow: -2 - 2147483647 cannot be represented in type 'int'
-#endif
-
-#ifdef SUB_I64
- (void)(int64_t(-8000000000000000000ll) - int64_t(2000000000000000000ll));
- // CHECK-SUB_I64: -8000000000000000000 - 2000000000000000000 cannot be represented in type '{{long( long)?}}'
-#endif
-
-#ifdef SUB_I128
-# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
- (void)(-(__int128_t(1) << 126) - (__int128_t(1) << 126) - 1);
-# else
- puts("__int128 not supported");
-# endif
- // CHECK-SUB_I128: {{0x80000000000000000000000000000000 - 1 cannot be represented in type '__int128'|__int128 not supported}}
-#endif
-}
diff --git a/test/ubsan/TestCases/Integer/summary.cpp b/test/ubsan/TestCases/Integer/summary.cpp
deleted file mode 100644
index 8726c14c3db0..000000000000
--- a/test/ubsan/TestCases/Integer/summary.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -fsanitize=integer %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
-// REQUIRES: ubsan-asan
-
-#include <stdint.h>
-
-int main() {
- (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
- // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:44
- // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: unsigned-integer-overflow {{.*}}summary.cpp:[[@LINE-2]]:44
- return 0;
-}
diff --git a/test/ubsan/TestCases/Integer/suppressions.cpp b/test/ubsan/TestCases/Integer/suppressions.cpp
deleted file mode 100644
index 65d8bba13b01..000000000000
--- a/test/ubsan/TestCases/Integer/suppressions.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// RUN: %clangxx -fsanitize=integer -g0 %s -o %t
-
-// Suppression by symbol name (unsigned-integer-overflow:do_overflow below)
-// requires the compiler-rt runtime to be able to symbolize stack addresses.
-// REQUIRES: can-symbolize
-// UNSUPPORTED: android
-// Output differs on OpenBSD longer by displaying the values.
-// XFAIL: openbsd
-
-// Fails without any suppression.
-// RUN: %env_ubsan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s
-
-// RUN: echo "signed-integer-overflow:%t" > %t.wrong-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.wrong-supp"' not %run %t 2>&1 | FileCheck %s
-
-// RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.func-supp"' %run %t
-// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' %run %t
-
-// Note: file-level suppressions should work even without debug info.
-// RUN: echo "unsigned-integer-overflow:%s" > %t.file-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.file-supp"' %run %t
-
-// Suppressions don't work for unrecoverable kinds.
-// RUN: %clangxx -fsanitize=integer -fno-sanitize-recover=integer %s -o %t-norecover
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' not %run %t-norecover 2>&1 | FileCheck %s
-
-#include <stdint.h>
-
-extern "C" void do_overflow() {
- (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
- // CHECK: runtime error: unsigned integer overflow
-}
-
-int main() {
- do_overflow();
- return 0;
-}
diff --git a/test/ubsan/TestCases/Integer/uadd-overflow.cpp b/test/ubsan/TestCases/Integer/uadd-overflow.cpp
deleted file mode 100644
index 8ef8983b56e0..000000000000
--- a/test/ubsan/TestCases/Integer/uadd-overflow.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// RUN: %clangxx -DADD_I32 -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I32
-// RUN: %clangxx -DADD_I64 -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I64
-// RUN: %clangxx -DADD_I128 -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I128
-
-#include <stdint.h>
-#include <stdio.h>
-
-int main() {
- // These promote to 'int'.
- (void)(uint8_t(0xff) + uint8_t(0xff));
- (void)(uint16_t(0xf0fff) + uint16_t(0x0fff));
-
-#ifdef ADD_I32
- uint32_t k = 0x87654321;
- k += 0xedcba987;
- // CHECK-ADD_I32: uadd-overflow.cpp:[[@LINE-1]]:5: runtime error: unsigned integer overflow: 2271560481 + 3989547399 cannot be represented in type 'unsigned int'
-#endif
-
-#ifdef ADD_I64
- (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
- // CHECK-ADD_I64: 10000000000000000000 + 9000000000000000000 cannot be represented in type 'unsigned {{long( long)?}}'
-#endif
-
-#ifdef ADD_I128
-# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
- (void)((__uint128_t(1) << 127) + (__uint128_t(1) << 127));
-# else
- puts("__int128 not supported");
-# endif
- // CHECK-ADD_I128: {{0x80000000000000000000000000000000 \+ 0x80000000000000000000000000000000 cannot be represented in type 'unsigned __int128'|__int128 not supported}}
-#endif
-}
diff --git a/test/ubsan/TestCases/Integer/uincdec-overflow.cpp b/test/ubsan/TestCases/Integer/uincdec-overflow.cpp
deleted file mode 100644
index 4cc73972dacd..000000000000
--- a/test/ubsan/TestCases/Integer/uincdec-overflow.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clangxx -DOP=n++ -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck --check-prefix=CHECK-INC %s
-// RUN: %clangxx -DOP=++n -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck --check-prefix=CHECK-INC %s
-// RUN: %clangxx -DOP=m-- -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck --check-prefix=CHECK-DEC %s
-// RUN: %clangxx -DOP=--m -fsanitize=unsigned-integer-overflow %s -o %t4 && %run %t4 2>&1 | FileCheck --check-prefix=CHECK-DEC %s
-
-#include <stdint.h>
-
-int main() {
- unsigned n = 0xfffffffd;
- n++;
- n++;
- unsigned m = 0;
- // CHECK-INC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 4294967295 + 1 cannot be represented in type 'unsigned int'
- // CHECK-DEC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
- OP;
-}
diff --git a/test/ubsan/TestCases/Integer/umul-overflow.cpp b/test/ubsan/TestCases/Integer/umul-overflow.cpp
deleted file mode 100644
index ad5d1bd0d13c..000000000000
--- a/test/ubsan/TestCases/Integer/umul-overflow.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <stdint.h>
-
-int main() {
- // These promote to 'int'.
- (void)(int8_t(-2) * int8_t(0x7f));
- (void)(int16_t(0x7fff) * int16_t(0x7fff));
- (void)(uint16_t(0xffff) * int16_t(0x7fff));
- (void)(uint16_t(0xffff) * uint16_t(0x8000));
-
- // Not an unsigned overflow
- (void)(uint16_t(0xffff) * uint16_t(0x8001));
-
- (void)(uint32_t(0xffffffff) * uint32_t(0x2));
- // CHECK: umul-overflow.cpp:15:31: runtime error: unsigned integer overflow: 4294967295 * 2 cannot be represented in type 'unsigned int'
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Integer/usub-overflow.cpp b/test/ubsan/TestCases/Integer/usub-overflow.cpp
deleted file mode 100644
index fb671b003af7..000000000000
--- a/test/ubsan/TestCases/Integer/usub-overflow.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// RUN: %clangxx -DSUB_I32 -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I32
-// RUN: %clangxx -DSUB_I64 -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I64
-// RUN: %clangxx -DSUB_I128 -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I128
-
-#include <stdint.h>
-#include <stdio.h>
-
-int main() {
- // These promote to 'int'.
- (void)(uint8_t(0) - uint8_t(0x7f));
- (void)(uint16_t(0) - uint16_t(0x7fff));
-
-#ifdef SUB_I32
- (void)(uint32_t(1) - uint32_t(2));
- // CHECK-SUB_I32: usub-overflow.cpp:[[@LINE-1]]:22: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned int'
-#endif
-
-#ifdef SUB_I64
- (void)(uint64_t(8000000000000000000ll) - uint64_t(9000000000000000000ll));
- // CHECK-SUB_I64: 8000000000000000000 - 9000000000000000000 cannot be represented in type 'unsigned {{long( long)?}}'
-#endif
-
-#ifdef SUB_I128
-# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
- (void)((__uint128_t(1) << 126) - (__uint128_t(1) << 127));
-# else
- puts("__int128 not supported\n");
-# endif
- // CHECK-SUB_I128: {{0x40000000000000000000000000000000 - 0x80000000000000000000000000000000 cannot be represented in type 'unsigned __int128'|__int128 not supported}}
-#endif
-}
diff --git a/test/ubsan/TestCases/Misc/Inputs/no-interception-dso.c b/test/ubsan/TestCases/Misc/Inputs/no-interception-dso.c
deleted file mode 100644
index 5ccc9b63d7c2..000000000000
--- a/test/ubsan/TestCases/Misc/Inputs/no-interception-dso.c
+++ /dev/null
@@ -1,3 +0,0 @@
-int dso_function(int i) {
- return i + 1;
-}
diff --git a/test/ubsan/TestCases/Misc/Inputs/returns-unexpectedly.c b/test/ubsan/TestCases/Misc/Inputs/returns-unexpectedly.c
deleted file mode 100644
index 826ea0ca496a..000000000000
--- a/test/ubsan/TestCases/Misc/Inputs/returns-unexpectedly.c
+++ /dev/null
@@ -1 +0,0 @@
-void returns_unexpectedly() {}
diff --git a/test/ubsan/TestCases/Misc/Linux/lit.local.cfg b/test/ubsan/TestCases/Misc/Linux/lit.local.cfg
deleted file mode 100644
index 57271b8078a4..000000000000
--- a/test/ubsan/TestCases/Misc/Linux/lit.local.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-def getRoot(config):
- if not config.parent:
- return config
- return getRoot(config.parent)
-
-root = getRoot(config)
-
-if root.host_os not in ['Linux']:
- config.unsupported = True
diff --git a/test/ubsan/TestCases/Misc/Linux/print_stack_trace.cc b/test/ubsan/TestCases/Misc/Linux/print_stack_trace.cc
deleted file mode 100644
index 341fd7a823b0..000000000000
--- a/test/ubsan/TestCases/Misc/Linux/print_stack_trace.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: %clangxx -fsanitize=undefined -O0 %s -o %t && UBSAN_OPTIONS=stack_trace_format=DEFAULT:fast_unwind_on_fatal=1 %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=undefined -O0 %s -o %t && UBSAN_OPTIONS=stack_trace_format=DEFAULT:fast_unwind_on_fatal=0 %run %t 2>&1 | FileCheck %s
-
-// This test is temporarily disabled due to broken unwinding on ARM.
-// UNSUPPORTED: -linux-
-
-// The test doesn't pass on Darwin in UBSan-TSan configuration, because TSan is
-// using the slow unwinder which is not supported on Darwin. The test should
-// be universal after landing of https://reviews.llvm.org/D32806.
-
-#include <sanitizer/common_interface_defs.h>
-
-static inline void FooBarBaz() {
- __sanitizer_print_stack_trace();
-}
-
-int main() {
- FooBarBaz();
- return 0;
-}
-
-// CHECK: {{.*}} in FooBarBaz{{.*}}print_stack_trace.cc{{.*}}
-// CHECK: {{.*}} in main{{.*}}print_stack_trace.cc{{.*}}
diff --git a/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc b/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc
deleted file mode 100644
index eac4c32a2839..000000000000
--- a/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// RUN: %clangxx -fsanitize=integer -fsanitize-recover=integer %s -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s
-
-// __ubsan_default_options() doesn't work on Darwin.
-// XFAIL: darwin
-
-#include <stdint.h>
-
-extern "C" const char *__ubsan_default_options() {
- return "halt_on_error=1";
-}
-
-int main() {
- (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
- // CHECK: ubsan_options.cc:[[@LINE-1]]:44: runtime error: unsigned integer overflow
- return 0;
-}
-
diff --git a/test/ubsan/TestCases/Misc/bool.cpp b/test/ubsan/TestCases/Misc/bool.cpp
deleted file mode 100644
index f6dc24e4bc78..000000000000
--- a/test/ubsan/TestCases/Misc/bool.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -fsanitize=bool %s -O3 -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
-
-unsigned char NotABool = 123;
-
-int main(int argc, char **argv) {
- bool *p = (bool*)&NotABool;
-
- // CHECK: bool.cpp:[[@LINE+1]]:10: runtime error: load of value 123, which is not a valid value for type 'bool'
- return *p;
- // SUMMARY: SUMMARY: {{.*}}Sanitizer: invalid-bool-load {{.*}}bool.cpp:[[@LINE-1]]
-}
diff --git a/test/ubsan/TestCases/Misc/bool.m b/test/ubsan/TestCases/Misc/bool.m
deleted file mode 100644
index 0430b452b987..000000000000
--- a/test/ubsan/TestCases/Misc/bool.m
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clang -fsanitize=bool %s -O3 -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
-
-typedef char BOOL;
-unsigned char NotABool = 123;
-
-int main(int argc, char **argv) {
- BOOL *p = (BOOL*)&NotABool;
-
- // CHECK: bool.m:[[@LINE+1]]:10: runtime error: load of value 123, which is not a valid value for type 'BOOL'
- return *p;
- // SUMMARY: SUMMARY: {{.*}}Sanitizer: invalid-bool-load {{.*}}bool.m:[[@LINE-1]]
-}
diff --git a/test/ubsan/TestCases/Misc/bounds.cpp b/test/ubsan/TestCases/Misc/bounds.cpp
deleted file mode 100644
index 9f890f290b34..000000000000
--- a/test/ubsan/TestCases/Misc/bounds.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// RUN: %clangxx -fsanitize=bounds %s -O3 -o %t
-// RUN: %run %t 0 0 0
-// RUN: %run %t 1 2 3
-// RUN: %expect_crash %run %t 2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK-A-2
-// RUN: %run %t 0 3 0 2>&1 | FileCheck %s --check-prefix=CHECK-B-3
-// RUN: %run %t 0 0 4 2>&1 | FileCheck %s --check-prefix=CHECK-C-4
-
-int get_int(int *const p __attribute__((pass_object_size(0))), int i) {
- // CHECK-A-2: bounds.cpp:[[@LINE+1]]:10: runtime error: index 2 out of bounds for type 'int *'
- return p[i];
-}
-
-int get_double(double *const p __attribute__((pass_object_size(0))), int i) {
- // CHECK-A-2: bounds.cpp:[[@LINE+1]]:10: runtime error: index 2 out of bounds for type 'double *'
- return p[i];
-}
-
-int main(int argc, char **argv) {
- int bar[2];
- get_int(bar, argv[1][0] - '0');
-
- double baz[2];
- get_double(baz, argv[1][0] - '0');
-
- int arr[2][3][4] = {};
-
- return arr[argv[1][0] - '0'][argv[2][0] - '0'][argv[3][0] - '0'];
- // CHECK-A-2: bounds.cpp:[[@LINE-1]]:10: runtime error: index 2 out of bounds for type 'int [2][3][4]'
- // CHECK-B-3: bounds.cpp:[[@LINE-2]]:10: runtime error: index 3 out of bounds for type 'int [3][4]'
- // CHECK-C-4: bounds.cpp:[[@LINE-3]]:10: runtime error: index 4 out of bounds for type 'int [4]'
-}
diff --git a/test/ubsan/TestCases/Misc/builtins.cpp b/test/ubsan/TestCases/Misc/builtins.cpp
deleted file mode 100644
index 18c68b5917a5..000000000000
--- a/test/ubsan/TestCases/Misc/builtins.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// REQUIRES: arch=x86_64
-//
-// RUN: %clangxx -fsanitize=builtin -w %s -O3 -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=RECOVER
-// RUN: %clangxx -fsanitize=builtin -fno-sanitize-recover=builtin -w %s -O3 -o %t.abort
-// RUN: not %run %t.abort 2>&1 | FileCheck %s --check-prefix=ABORT
-
-void check_ctz(int n) {
- // ABORT: builtins.cpp:[[@LINE+2]]:17: runtime error: passing zero to ctz(), which is not a valid argument
- // RECOVER: builtins.cpp:[[@LINE+1]]:17: runtime error: passing zero to ctz(), which is not a valid argument
- __builtin_ctz(n);
-
- // RECOVER: builtins.cpp:[[@LINE+1]]:18: runtime error: passing zero to ctz(), which is not a valid argument
- __builtin_ctzl(n);
-
- // RECOVER: builtins.cpp:[[@LINE+1]]:19: runtime error: passing zero to ctz(), which is not a valid argument
- __builtin_ctzll(n);
-}
-
-void check_clz(int n) {
- // RECOVER: builtins.cpp:[[@LINE+1]]:17: runtime error: passing zero to clz(), which is not a valid argument
- __builtin_clz(n);
-
- // RECOVER: builtins.cpp:[[@LINE+1]]:18: runtime error: passing zero to clz(), which is not a valid argument
- __builtin_clzl(n);
-
- // RECOVER: builtins.cpp:[[@LINE+1]]:19: runtime error: passing zero to clz(), which is not a valid argument
- __builtin_clzll(n);
-}
-
-int main() {
- check_ctz(0);
- check_clz(0);
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/coverage-levels.cc b/test/ubsan/TestCases/Misc/coverage-levels.cc
deleted file mode 100644
index 364f985c5051..000000000000
--- a/test/ubsan/TestCases/Misc/coverage-levels.cc
+++ /dev/null
@@ -1,48 +0,0 @@
-// Test various levels of coverage
-//
-// FIXME: Port the environment variable logic below for the lit shell.
-// REQUIRES: shell
-//
-// RUN: rm -rf %t-dir && mkdir %t-dir
-// RUN: %clangxx -fsanitize=shift -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
-// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
-// RUN: %clangxx -fsanitize=undefined -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
-// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
-
-// Also works without any sanitizer.
-// RUN: %clangxx -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
-// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
-
-// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=func %s -o %t
-// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
-// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=bb %s -o %t
-// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN
-// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=edge %s -o %t
-// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%t-dir"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN
-
-// Coverage is not yet implemented in TSan.
-// XFAIL: ubsan-tsan
-// UNSUPPORTED: ubsan-standalone-static
-// No coverage support
-// UNSUPPORTED: openbsd
-
-volatile int sink;
-int main(int argc, char **argv) {
- int shift = argc * 32;
-#if GOOD_SHIFT
- shift = 3;
-#endif
- if ((argc << shift) == 16) // False.
- return 1;
- return 0;
-}
-
-// CHECK_WARN: shift exponent 32 is too large
-// CHECK_NOWARN-NOT: ERROR
-// FIXME: Currently, coverage instrumentation kicks in after ubsan, so we get
-// more than the minimal number of instrumented blocks.
-// FIXME: Currently, ubsan with -fno-sanitize-recover and w/o asan will fail
-// to dump coverage.
-// CHECK1: 1 PCs written
-// CHECK2: 2 PCs written
-// CHECK3: 2 PCs written
diff --git a/test/ubsan/TestCases/Misc/deduplication.cpp b/test/ubsan/TestCases/Misc/deduplication.cpp
deleted file mode 100644
index 4b02590fa0ac..000000000000
--- a/test/ubsan/TestCases/Misc/deduplication.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// RUN: %clangxx -fsanitize=undefined %s -o %t && %run %t 2>&1 | FileCheck %s
-// Verify deduplication works by ensuring only one diag is emitted.
-#include <limits.h>
-#include <stdio.h>
-
-void overflow() {
- int i = INT_MIN;
- --i;
-}
-
-int main() {
- // CHECK: Start
- fprintf(stderr, "Start\n");
- fflush(stderr);
-
- // CHECK: runtime error
- // CHECK-NOT: runtime error
- // CHECK-NOT: runtime error
- overflow();
- overflow();
- overflow();
-
- // CHECK: End
- fprintf(stderr, "End\n");
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/enum.cpp b/test/ubsan/TestCases/Misc/enum.cpp
deleted file mode 100644
index 8e95f8b403a9..000000000000
--- a/test/ubsan/TestCases/Misc/enum.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// RUN: %clangxx -fsanitize=enum %s -O3 -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-PLAIN
-// RUN: %clangxx -fsanitize=enum -std=c++11 -DE="class E" %s -O3 -o %t && %run %t
-// RUN: %clangxx -fsanitize=enum -std=c++11 -DE="class E : bool" %s -O3 -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-BOOL
-
-// FIXME: UBSan fails to add the correct instrumentation code for some reason on
-// Windows.
-// XFAIL: windows-msvc
-
-enum E { a = 1 } e;
-#undef E
-
-int main(int argc, char **argv) {
- // memset(&e, 0xff, sizeof(e));
- for (unsigned char *p = (unsigned char*)&e; p != (unsigned char*)(&e + 1); ++p)
- *p = 0xff;
-
- // CHECK-PLAIN: error: load of value 4294967295, which is not a valid value for type 'enum E'
- // FIXME: Support marshalling and display of enum class values.
- // CHECK-BOOL: error: load of value <unknown>, which is not a valid value for type 'enum E'
- return (int)e != -1;
-}
diff --git a/test/ubsan/TestCases/Misc/log-path_test.cc b/test/ubsan/TestCases/Misc/log-path_test.cc
deleted file mode 100644
index 23ad7e27d21f..000000000000
--- a/test/ubsan/TestCases/Misc/log-path_test.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
-// XFAIL: android
-
-// The globs below do not work in the lit shell.
-// REQUIRES: shell
-
-// RUN: %clangxx -fsanitize=undefined %s -O1 -o %t
-
-// Regular run.
-// RUN: %run %t -4 2> %t.out
-// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.out
-
-// Good log_path.
-// RUN: rm -f %t.log.*
-// RUN: %device_rm -f '%t.log.*'
-// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t -4 2> %t.out
-// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
-
-// Run w/o errors should not produce any log.
-// RUN: rm -f %t.log.*
-// RUN: %device_rm -f '%t.log.*'
-// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t 4
-// RUN: not cat %t.log.*
-
-// FIXME: log_path is not supported on Windows yet.
-// XFAIL: windows-msvc
-
-#include <stdio.h>
-#include <stdlib.h>
-int main(int argc, char *argv[]) {
- double a = atof(argv[1]);
- unsigned int ai = (unsigned int) a;
- printf("%f %u\n", a, ai);
- return 0;
-}
-
-// CHECK-ERROR: runtime error: -4 is outside the range of representable values of type 'unsigned int'
-
diff --git a/test/ubsan/TestCases/Misc/missing_return.cpp b/test/ubsan/TestCases/Misc/missing_return.cpp
deleted file mode 100644
index fe8c8bae603d..000000000000
--- a/test/ubsan/TestCases/Misc/missing_return.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clangxx -fsanitize=return %gmlt %s -O3 -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-STACKTRACE
-// Error message does not exact what expected
-// XFAIL: openbsd
-
-// CHECK: missing_return.cpp:[[@LINE+1]]:5: runtime error: execution reached the end of a value-returning function without returning a value
-int f() {
-// CHECK-STACKTRACE: #0 {{.*}}f{{.*}}missing_return.cpp:[[@LINE-1]]
-}
-
-int main(int, char **argv) {
- return f();
-}
diff --git a/test/ubsan/TestCases/Misc/monitor.cpp b/test/ubsan/TestCases/Misc/monitor.cpp
deleted file mode 100644
index c02702847afb..000000000000
--- a/test/ubsan/TestCases/Misc/monitor.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// RUN: %clangxx -w -fsanitize=bool %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s
-
-// __ubsan_on_report is not defined as weak. Redefining it here isn't supported
-// on Windows.
-//
-// UNSUPPORTED: windows-msvc
-// Linkage issue
-// XFAIL: openbsd
-
-#include <cstdio>
-
-extern "C" {
-void __ubsan_get_current_report_data(const char **OutIssueKind,
- const char **OutMessage,
- const char **OutFilename,
- unsigned *OutLine, unsigned *OutCol,
- char **OutMemoryAddr);
-
-// Override the definition of __ubsan_on_report from the runtime, just for
-// testing purposes.
-void __ubsan_on_report(void) {
- const char *IssueKind, *Message, *Filename;
- unsigned Line, Col;
- char *Addr;
- __ubsan_get_current_report_data(&IssueKind, &Message, &Filename, &Line, &Col,
- &Addr);
-
- printf("Issue: %s\n", IssueKind);
- printf("Location: %s:%u:%u\n", Filename, Line, Col);
- printf("Message: %s\n", Message);
-
- (void)Addr;
-}
-}
-
-int main() {
- char C = 3;
- bool B = *(bool *)&C;
- // CHECK: Issue: invalid-bool-load
- // CHECK-NEXT: Location: {{.*}}monitor.cpp:[[@LINE-2]]:12
- // CHECK-NEXT: Message: Load of value 3, which is not a valid value for type 'bool'
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/no-interception.cpp b/test/ubsan/TestCases/Misc/no-interception.cpp
deleted file mode 100644
index c82fed3bf3f6..000000000000
--- a/test/ubsan/TestCases/Misc/no-interception.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// REQUIRES: android
-
-// Tests that ubsan can detect errors on Android if libc appears before the
-// runtime in the library search order, which means that we cannot intercept
-// symbols.
-
-// RUN: %clangxx %p/Inputs/no-interception-dso.c -fsanitize=undefined -fPIC -shared -o %dynamiclib %ld_flags_rpath_so
-
-// Make sure that libc is first in DT_NEEDED.
-// RUN: %clangxx %s -lc -o %t %ld_flags_rpath_exe
-// RUN: %run %t 2>&1 | FileCheck %s
-
-#include <limits.h>
-
-int dso_function(int);
-
-int main(int argc, char **argv) {
- // CHECK: signed integer overflow
- dso_function(INT_MAX);
-}
diff --git a/test/ubsan/TestCases/Misc/nonnull-arg.cpp b/test/ubsan/TestCases/Misc/nonnull-arg.cpp
deleted file mode 100644
index 0332d96c0213..000000000000
--- a/test/ubsan/TestCases/Misc/nonnull-arg.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// RUN: %clangxx -fsanitize=nonnull-attribute -fno-sanitize-recover=all %s -O3 -o %t
-// RUN: %run %t nc
-// RUN: %run %t nm
-// RUN: %run %t nf
-// RUN: %run %t nv
-// RUN: not %run %t 0c 2>&1 | FileCheck %s --check-prefix=CTOR
-// RUN: not %run %t 0m 2>&1 | FileCheck %s --check-prefix=METHOD
-// RUN: not %run %t 0f 2>&1 | FileCheck %s --check-prefix=FUNC
-// RUN: not %run %t 0v 2>&1 | FileCheck %s --check-prefix=VARIADIC
-//
-// AArch64 lacks variadic instrumentation for MSAN.
-// REQUIRES: stable-runtime
-
-class C {
- int *null_;
- int *nonnull_;
-
-public:
- C(int *null, __attribute__((nonnull)) int *nonnull)
- : null_(null), nonnull_(nonnull) {}
- int value() { return *nonnull_; }
- int method(int *nonnull, int *null) __attribute__((nonnull(2))) {
- return *nonnull_ + *nonnull;
- }
-};
-
-__attribute__((nonnull)) int func(int *nonnull) { return *nonnull; }
-
-#include <stdarg.h>
-__attribute__((nonnull)) int variadic(int x, ...) {
- va_list args;
- va_start(args, x);
- int *nonnull = va_arg(args, int*);
- int res = *nonnull;
- va_end(args);
- return res;
-}
-
-int main(int argc, char *argv[]) {
- int local = 0;
- int *arg = (argv[1][0] == '0') ? 0x0 : &local;
- switch (argv[1][1]) {
- case 'c':
- return C(0x0, arg).value();
- // CTOR: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:21: runtime error: null pointer passed as argument 2, which is declared to never be null
- // CTOR-NEXT: {{.*}}nonnull-arg.cpp:19:31: note: nonnull attribute specified here
- case 'm':
- return C(0x0, &local).method(arg, 0x0);
- // METHOD: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:36: runtime error: null pointer passed as argument 1, which is declared to never be null
- // METHOD-NEXT: {{.*}}nonnull-arg.cpp:22:54: note: nonnull attribute specified here
- case 'f':
- return func(arg);
- // FUNC: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:19: runtime error: null pointer passed as argument 1, which is declared to never be null
- // FUNC-NEXT: {{.*}}nonnull-arg.cpp:27:16: note: nonnull attribute specified here
- case 'v':
- return variadic(42, arg);
- // VARIADIC: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:27: runtime error: null pointer passed as argument 2, which is declared to never be null
- // VARIADIC-NEXT: {{.*}}nonnull-arg.cpp:30:16: note: nonnull attribute specified here
- }
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/nonnull.cpp b/test/ubsan/TestCases/Misc/nonnull.cpp
deleted file mode 100644
index d5cd2bf763b7..000000000000
--- a/test/ubsan/TestCases/Misc/nonnull.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// RUN: %clangxx -fsanitize=returns-nonnull-attribute -w %s -O3 -o %t
-// RUN: %run %t foo 2>&1 | count 0
-// RUN: %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx -fsanitize=returns-nonnull-attribute -fno-sanitize-recover=returns-nonnull-attribute -w %s -O3 -o %t.abort
-// RUN: not %run %t.abort &> /dev/null
-
-__attribute__((returns_nonnull)) char *foo(char *a);
-
-char *foo(char *a) {
- // CHECK: nonnull.cpp:[[@LINE+2]]:3: runtime error: null pointer returned from function declared to never return null
- // CHECK-NEXT: nonnull.cpp:[[@LINE-4]]:16: note: returns_nonnull attribute specified here
- return a;
-}
-
-__attribute__((returns_nonnull)) char *bar(int x, char *a) {
- if (x > 10) {
- // CHECK: nonnull.cpp:[[@LINE+2]]:5: runtime error: null pointer returned from function declared to never return null
- // CHECK-NEXT: nonnull.cpp:[[@LINE-3]]:16: note: returns_nonnull attribute specified here
- return a;
- } else {
- // CHECK: nonnull.cpp:[[@LINE+2]]:5: runtime error: null pointer returned from function declared to never return null
- // CHECK-NEXT: nonnull.cpp:[[@LINE-7]]:16: note: returns_nonnull attribute specified here
- return a;
- }
-}
-
-int main(int argc, char **argv) {
- char *a = argv[1];
-
- foo(a);
-
- bar(20, a);
-
- // We expect to see a runtime error the first time we cover the "else"...
- bar(5, a);
-
- // ... but not a second time.
- // CHECK-NOT: runtime error
- bar(5, a);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/nullability.c b/test/ubsan/TestCases/Misc/nullability.c
deleted file mode 100644
index a6ddf0e2315b..000000000000
--- a/test/ubsan/TestCases/Misc/nullability.c
+++ /dev/null
@@ -1,62 +0,0 @@
-// RUN: %clang -w -fsanitize=nullability-arg,nullability-assign,nullability-return %s -O3 -o %t
-// RUN: %run %t foo 2>&1 | count 0
-// RUN: %run %t 2>&1 | FileCheck %s
-
-// CHECK: nullability.c:[[@LINE+2]]:41: runtime error: null pointer returned from function declared to never return null
-// CHECK-NEXT: nullability.c:[[@LINE+1]]:6: note: _Nonnull return type annotation specified here
-int *_Nonnull nonnull_retval1(int *p) { return p; }
-
-// CHECK: nullability.c:1001:22: runtime error: null pointer passed as argument 2, which is declared to never be null
-// CHECK-NEXT: nullability.c:[[@LINE+1]]:56: note: _Nonnull type annotation specified here
-int *_Nonnull nonnull_retval2(int *_Nonnull arg1, int *_Nonnull arg2,
- int *_Nullable arg3, int *arg4, int arg5, ...) {
- return arg1;
-}
-
-// CHECK: nullability.c:1002:15: runtime error: null pointer passed as argument 1, which is declared to never be null
-// CHECK-NEXT: nullability.c:[[@LINE+1]]:23: note: _Nonnull type annotation specified here
-void nonnull_arg(int *_Nonnull p) {}
-
-void nonnull_assign1(int *p) {
- int *_Nonnull local;
-// CHECK: nullability.c:[[@LINE+1]]:9: runtime error: _Nonnull binding to null pointer of type 'int * _Nonnull'
- local = p;
-}
-
-void nonnull_assign2(int *p) {
- int *_Nonnull arr[1];
- // CHECK: nullability.c:[[@LINE+1]]:10: runtime error: _Nonnull binding to null pointer of type 'int * _Nonnull'
- arr[0] = p;
-}
-
-struct S1 {
- int *_Nonnull mptr;
-};
-
-void nonnull_assign3(int *p) {
- struct S1 s;
- // CHECK: nullability.c:[[@LINE+1]]:10: runtime error: _Nonnull binding to null pointer of type 'int * _Nonnull'
- s.mptr = p;
-}
-
-// CHECK: nullability.c:[[@LINE+1]]:52: runtime error: _Nonnull binding to null pointer of type 'int * _Nonnull'
-void nonnull_init1(int *p) { int *_Nonnull local = p; }
-
-// CHECK: nullability.c:[[@LINE+2]]:53: runtime error: _Nonnull binding to null pointer of type 'int * _Nonnull'
-// CHECK: nullability.c:[[@LINE+1]]:56: runtime error: _Nonnull binding to null pointer of type 'int * _Nonnull'
-void nonnull_init2(int *p) { int *_Nonnull arr[] = {p, p}; }
-
-int main(int argc, char **argv) {
- int *p = (argc > 1) ? &argc : ((int *)0);
-
-#line 1000
- nonnull_retval1(p);
- nonnull_retval2(p, p, p, p, 0, 0, 0, 0);
- nonnull_arg(p);
- nonnull_assign1(p);
- nonnull_assign2(p);
- nonnull_assign3(p);
- nonnull_init1(p);
- nonnull_init2(p);
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/unreachable.cpp b/test/ubsan/TestCases/Misc/unreachable.cpp
deleted file mode 100644
index 1b096721ce9c..000000000000
--- a/test/ubsan/TestCases/Misc/unreachable.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// RUN: %clang %S/Inputs/returns-unexpectedly.c -O3 -c -o %t.ru.o
-// RUN: %clangxx -fsanitize=unreachable -O3 -o %t %s %t.ru.o
-// RUN: not %run %t builtin 2>&1 | FileCheck %s -check-prefix=BUILTIN
-// RUN: not %run %t noreturn-callee-marked 2>&1 | FileCheck %s -check-prefix=NORETURN1
-// RUN: not %run %t noreturn-caller-marked 2>&1 | FileCheck %s -check-prefix=NORETURN2
-
-#include <string.h>
-
-void __attribute__((noreturn)) callee_marked_noreturn() {
- // NORETURN1: unreachable.cpp:[[@LINE+1]]:1: runtime error: execution reached an unreachable program point
-}
-
-extern "C" void __attribute__((noreturn)) returns_unexpectedly();
-
-int main(int, char **argv) {
- if (strcmp(argv[1], "builtin") == 0)
- // BUILTIN: unreachable.cpp:[[@LINE+1]]:5: runtime error: execution reached an unreachable program point
- __builtin_unreachable();
- else if (strcmp(argv[1], "noreturn-callee-marked") == 0)
- callee_marked_noreturn();
- else if (strcmp(argv[1], "noreturn-caller-marked") == 0)
- // NORETURN2: unreachable.cpp:[[@LINE+1]]:5: runtime error: execution reached an unreachable program point
- returns_unexpectedly();
- return 0;
-}
diff --git a/test/ubsan/TestCases/Misc/vla.c b/test/ubsan/TestCases/Misc/vla.c
deleted file mode 100644
index 1939551f2ddb..000000000000
--- a/test/ubsan/TestCases/Misc/vla.c
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: %clang -fsanitize=vla-bound %s -O3 -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MINUS-ONE
-// RUN: %run %t a 2>&1 | FileCheck %s --check-prefix=CHECK-ZERO
-// RUN: %run %t a b
-
-int main(int argc, char **argv) {
- // CHECK-MINUS-ONE: vla.c:[[@LINE+2]]:11: runtime error: variable length array bound evaluates to non-positive value -1
- // CHECK-ZERO: vla.c:[[@LINE+1]]:11: runtime error: variable length array bound evaluates to non-positive value 0
- int arr[argc - 2];
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-lvalue.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-lvalue.cpp
deleted file mode 100644
index 97d4b4623c2d..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-lvalue.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-typedef char *__attribute__((align_value(0x8000))) aligned_char;
-
-struct ac_struct {
- aligned_char a;
-};
-
-char *load_from_ac_struct(struct ac_struct *x) {
- return x->a;
-}
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- struct ac_struct x;
- x.a = ptr + 1; // FIXME: it is weird that this does not also have an assumption.
- load_from_ac_struct(&x);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-9]]:13: runtime error: assumption of 32768 byte alignment for pointer of type 'aligned_char' (aka 'char *') failed
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-17]]:30: note: alignment assumption was specified here
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-paramvar.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-paramvar.cpp
deleted file mode 100644
index 774ba90fbe92..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-align_value-on-paramvar.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-char *passthrough(__attribute__((align_value(0x8000))) char *x) {
- return x;
-}
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- passthrough(ptr + 1);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-7]]:10: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-9]]:34: note: alignment assumption was specified here
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- // FIXME: shouldn't there be an assumption on the caller's side too?
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function-variable.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function-variable.cpp
deleted file mode 100644
index c71cb1e1bc7b..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function-variable.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-char *__attribute__((alloc_align(2)))
-passthrough(char *x, unsigned long alignment) {
- return x;
-}
-
-unsigned long alignment;
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- alignment = 0x8000;
-
- passthrough(ptr + 1, alignment);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:3: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-14]]:22: note: alignment assumption was specified here
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function.cpp
deleted file mode 100644
index db22e3a8fcff..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-alloc_align-on-function.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-char *__attribute__((alloc_align(2)))
-passthrough(char *x, unsigned long alignment) {
- return x;
-}
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- passthrough(ptr + 1, 0x8000);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:3: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-10]]:22: note: alignment assumption was specified here
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp
deleted file mode 100644
index 33aa132f601b..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-char *__attribute__((assume_aligned(0x8000, 1))) passthrough(char *x) {
- return x;
-}
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(3);
-
- passthrough(ptr + 2);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:3: runtime error: assumption of 32768 byte alignment (with offset of 1 byte) for pointer of type 'char *' failed
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-9]]:22: note: alignment assumption was specified here
- // CHECK: 0x{{.*}}: note: offset address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function.cpp
deleted file mode 100644
index 202c0ce00639..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-attribute-assume_aligned-on-function.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-char *__attribute__((assume_aligned(0x8000))) passthrough(char *x) {
- return x;
-}
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- passthrough(ptr + 1);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:3: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-9]]:22: note: alignment assumption was specified here
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-blacklist.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-blacklist.cpp
deleted file mode 100644
index c0c7b373f623..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-blacklist.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: %clang -fsanitize=alignment -fno-sanitize-recover=alignment -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption "
-
-// RUN: rm -f %tmp
-// RUN: echo "[alignment]" >> %tmp
-// RUN: echo "fun:main" >> %tmp
-// RUN: %clang -fsanitize=alignment -fno-sanitize-recover=alignment -fsanitize-blacklist=%tmp -O0 %s -o %t && %run %t 2>&1
-
-#include <stdlib.h>
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- __builtin_assume_aligned(ptr + 1, 0x8000);
- // CHECK: {{.*}}alignment-assumption-blacklist.cpp:[[@LINE-1]]:32: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params-variable.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
deleted file mode 100644
index cc4e1f2184da..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-volatile long offset;
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(3);
-
- offset = 1;
-
- __builtin_assume_aligned(ptr + 2, 0x8000, offset);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:32: runtime error: assumption of 32768 byte alignment (with offset of 1 byte) for pointer of type 'char *' failed
- // CHECK: 0x{{.*}}: note: offset address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params.cpp
deleted file mode 100644
index 724abd540e78..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-three-params.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(3);
-
- __builtin_assume_aligned(ptr + 2, 0x8000, 1);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:32: runtime error: assumption of 32768 byte alignment (with offset of 1 byte) for pointer of type 'char *' failed
- // CHECK: 0x{{.*}}: note: offset address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-two-params.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-two-params.cpp
deleted file mode 100644
index 2737f3d08b44..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-builtin_assume_aligned-two-params.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- __builtin_assume_aligned(ptr + 1, 0x8000);
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-1]]:32: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-openmp.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-openmp.cpp
deleted file mode 100644
index 482316ee254f..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-openmp.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// RUN: %clang -x c -fsanitize=alignment -fopenmp-simd -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -fopenmp-simd -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -fopenmp-simd -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c -fsanitize=alignment -fopenmp-simd -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-// RUN: %clang -x c++ -fsanitize=alignment -fopenmp-simd -O0 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -fopenmp-simd -O1 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -fopenmp-simd -O2 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-// RUN: %clang -x c++ -fsanitize=alignment -fopenmp-simd -O3 %s -o %t && %run %t 2>&1 | FileCheck %s --implicit-check-not=" assumption " --implicit-check-not="note:" --implicit-check-not="error:"
-
-#include <stdlib.h>
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
- char *data = ptr + 1;
-
- data[0] = 0;
-
-#pragma omp for simd aligned(data : 0x8000)
- for(int x = 0; x < 1; x++)
- data[x] = data[x];
- // CHECK: {{.*}}alignment-assumption-{{.*}}.cpp:[[@LINE-3]]:30: runtime error: assumption of 32768 byte alignment for pointer of type 'char *' failed
- // CHECK: 0x{{.*}}: note: address is {{.*}} aligned, misalignment offset is {{.*}} byte
-
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp b/test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp
deleted file mode 100644
index cc7769a06fe5..000000000000
--- a/test/ubsan/TestCases/Pointer/alignment-assumption-summary.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// RUN: %clangxx -fsanitize=alignment %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
-// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
-// REQUIRES: !ubsan-standalone && !ubsan-standalone-static
-
-#include <stdlib.h>
-
-int main(int argc, char* argv[]) {
- char *ptr = (char *)malloc(2);
-
- __builtin_assume_aligned(ptr + 1, 0x8000);
- // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:32
- // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: alignment-assumption {{.*}}summary.cpp:[[@LINE-2]]:32
- free(ptr);
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/index-overflow.cpp b/test/ubsan/TestCases/Pointer/index-overflow.cpp
deleted file mode 100644
index f9b1fea08c94..000000000000
--- a/test/ubsan/TestCases/Pointer/index-overflow.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: %clangxx -fsanitize=pointer-overflow %s -o %t
-// RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=ERR
-// RUN: %run %t 0 2>&1 | FileCheck %s --check-prefix=SAFE
-// RUN: %run %t -1 2>&1 | FileCheck %s --check-prefix=SAFE
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-int main(int argc, char *argv[]) {
- // SAFE-NOT: runtime error
- // ERR: runtime error: pointer index expression with base {{.*}} overflowed to
-
- char *p = (char *)(UINTPTR_MAX);
-
- printf("%p\n", p + atoi(argv[1]));
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp b/test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp
deleted file mode 100644
index 5a1432625a54..000000000000
--- a/test/ubsan/TestCases/Pointer/unsigned-index-expression.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// RUN: %clangxx -std=c++11 -fsanitize=pointer-overflow %s -o %t
-// RUN: %run %t 2>&1 | FileCheck %s
-
-int main(int argc, char *argv[]) {
- char c;
- char *p = &c;
- unsigned long long neg_1 = -1;
-
- // CHECK: unsigned-index-expression.cpp:[[@LINE+1]]:15: runtime error: addition of unsigned offset to 0x{{.*}} overflowed to 0x{{.*}}
- char *q = p + neg_1;
-
- // CHECK: unsigned-index-expression.cpp:[[@LINE+1]]:16: runtime error: subtraction of unsigned offset from 0x{{.*}} overflowed to 0x{{.*}}
- char *q1 = p - neg_1;
-
- // CHECK: unsigned-index-expression.cpp:[[@LINE+2]]:16: runtime error: pointer index expression with base 0x{{0*}} overflowed to 0x{{.*}}
- char *n = nullptr;
- char *q2 = n - 1ULL;
-
- return 0;
-}
diff --git a/test/ubsan/TestCases/TypeCheck/Function/function.cpp b/test/ubsan/TestCases/TypeCheck/Function/function.cpp
deleted file mode 100644
index 31baa2af8ca9..000000000000
--- a/test/ubsan/TestCases/TypeCheck/Function/function.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-// RUN: %clangxx -std=c++17 -fsanitize=function %s -O3 -g -o %t
-// RUN: %run %t 2>&1 | FileCheck %s
-// Verify that we can disable symbolization if needed:
-// RUN: %env_ubsan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOSYM
-// XFAIL: windows-msvc
-// Unsupported function flag
-// UNSUPPORTED: openbsd
-
-#include <stdint.h>
-
-void f() {}
-
-void g(int x) {}
-
-void make_valid_call() {
- // CHECK-NOT: runtime error: call to function g
- reinterpret_cast<void (*)(int)>(reinterpret_cast<uintptr_t>(g))(42);
-}
-
-void make_invalid_call() {
- // CHECK: function.cpp:[[@LINE+4]]:3: runtime error: call to function f() through pointer to incorrect function type 'void (*)(int)'
- // CHECK-NEXT: function.cpp:[[@LINE-11]]: note: f() defined here
- // NOSYM: function.cpp:[[@LINE+2]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
- // NOSYM-NEXT: ({{.*}}+0x{{.*}}): note: (unknown) defined here
- reinterpret_cast<void (*)(int)>(reinterpret_cast<uintptr_t>(f))(42);
-}
-
-void f1(int) {}
-void f2(unsigned int) {}
-void f3(int) noexcept {}
-void f4(unsigned int) noexcept {}
-
-void check_noexcept_calls() {
- void (*p1)(int);
- p1 = &f1;
- p1(0);
- p1 = reinterpret_cast<void (*)(int)>(&f2);
- // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f2(unsigned int) through pointer to incorrect function type 'void (*)(int)'
- // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
- p1(0);
- p1 = &f3;
- p1(0);
- p1 = reinterpret_cast<void (*)(int)>(&f4);
- // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f4(unsigned int) through pointer to incorrect function type 'void (*)(int)'
- // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
- p1(0);
-
- void (*p2)(int) noexcept;
- p2 = reinterpret_cast<void (*)(int) noexcept>(&f1);
- // TODO: Unclear whether calling a non-noexcept function through a pointer to
- // nexcept function should cause an error.
- // CHECK-NOT: function.cpp:[[@LINE+2]]:3: runtime error: call to function f1(int) through pointer to incorrect function type 'void (*)(int) noexcept'
- // NOSYM-NOT: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int) noexcept'
- p2(0);
- p2 = reinterpret_cast<void (*)(int) noexcept>(&f2);
- // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f2(unsigned int) through pointer to incorrect function type 'void (*)(int) noexcept'
- // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int) noexcept'
- p2(0);
- p2 = &f3;
- p2(0);
- p2 = reinterpret_cast<void (*)(int) noexcept>(&f4);
- // CHECK: function.cpp:[[@LINE+2]]:3: runtime error: call to function f4(unsigned int) through pointer to incorrect function type 'void (*)(int) noexcept'
- // NOSYM: function.cpp:[[@LINE+1]]:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int) noexcept'
- p2(0);
-}
-
-int main(void) {
- make_valid_call();
- make_invalid_call();
- check_noexcept_calls();
- // Check that no more errors will be printed.
- // CHECK-NOT: runtime error: call to function
- // NOSYM-NOT: runtime error: call to function
- make_invalid_call();
-}
diff --git a/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg b/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg
deleted file mode 100644
index a10159995f41..000000000000
--- a/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-# The function type checker is only supported on x86 and x86_64 for now.
-if config.target_arch not in ['x86', 'x86_64']:
- config.unsupported = True
diff --git a/test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp b/test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp
deleted file mode 100644
index a5e61c2d2439..000000000000
--- a/test/ubsan/TestCases/TypeCheck/Linux/PR33221.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// RUN: %clangxx -std=c++11 -frtti -fsanitize=vptr -g %s -O3 -o %t
-// RUN: %run %t &> %t.log
-// RUN: cat %t.log | not count 0 && FileCheck --input-file %t.log %s || cat %t.log | count 0
-
-// REQUIRES: cxxabi
-
-#include <sys/mman.h>
-#include <unistd.h>
-
-class Base {
-public:
- int i;
- virtual void print() {}
-};
-
-class Derived : public Base {
-public:
- void print() {}
-};
-
-
-int main() {
- int page_size = getpagesize();
-
- void *non_accessible = mmap(nullptr, page_size * 2, PROT_NONE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
- if (non_accessible == MAP_FAILED)
- return 0;
-
- void *accessible = mmap((char*)non_accessible + page_size, page_size,
- PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- if (accessible == MAP_FAILED)
- return 0;
-
- char *c = new char[sizeof(Derived)];
-
- // The goal is to trigger a condition when Vptr points to accessible memory,
- // but VptrPrefix does not. That has been triggering SIGSEGV in UBSan code.
- void **vtable_ptr = reinterpret_cast<void **>(c);
- *vtable_ptr = (void*)accessible;
-
- Derived *list = (Derived *)c;
-
-// CHECK: PR33221.cpp:[[@LINE+2]]:19: runtime error: member access within address {{.*}} which does not point to an object of type 'Base'
-// CHECK-NEXT: invalid vptr
- int foo = list->i;
- return 0;
-}
diff --git a/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg b/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg
deleted file mode 100644
index 57271b8078a4..000000000000
--- a/test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg
+++ /dev/null
@@ -1,9 +0,0 @@
-def getRoot(config):
- if not config.parent:
- return config
- return getRoot(config.parent)
-
-root = getRoot(config)
-
-if root.host_os not in ['Linux']:
- config.unsupported = True
diff --git a/test/ubsan/TestCases/TypeCheck/PR33221.cpp b/test/ubsan/TestCases/TypeCheck/PR33221.cpp
deleted file mode 100644
index 6088338a3dee..000000000000
--- a/test/ubsan/TestCases/TypeCheck/PR33221.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// RUN: %clangxx -frtti -fsanitize=null,vptr -g %s -O3 -o %t
-// RUN: %run %t 2>&1 | FileCheck %s
-
-// REQUIRES: cxxabi
-// UNSUPPORTED: windows-msvc
-
-#include <string.h>
-
-class Base {
-public:
- int i;
- virtual void print() {}
-};
-
-class Derived : public Base {
-public:
- void print() {}
-};
-
-int main() {
- char *c = new char[sizeof(Derived)];
- memset((void *)c, 0xFF, sizeof(Derived));
- Derived *list = (Derived *)c;
-
-// CHECK: PR33221.cpp:[[@LINE+2]]:19: runtime error: member access within address {{.*}} which does not point to an object of type 'Base'
-// CHECK-NEXT: invalid vptr
- int foo = list->i;
- return 0;
-}
diff --git a/test/ubsan/TestCases/TypeCheck/misaligned.cpp b/test/ubsan/TestCases/TypeCheck/misaligned.cpp
deleted file mode 100644
index a5cefaa31cd6..000000000000
--- a/test/ubsan/TestCases/TypeCheck/misaligned.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// RUN: %clangxx %gmlt -fsanitize=alignment %s -O3 -o %t
-// RUN: %run %t l0 && %run %t s0 && %run %t r0 && %run %t m0 && %run %t f0 && %run %t n0 && %run %t u0
-// RUN: %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --strict-whitespace
-// RUN: %run %t s1 2>&1 | FileCheck %s --check-prefix=CHECK-STORE
-// RUN: %run %t r1 2>&1 | FileCheck %s --check-prefix=CHECK-REFERENCE
-// RUN: %run %t m1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
-// RUN: %run %t f1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
-// RUN: %run %t n1 2>&1 | FileCheck %s --check-prefix=CHECK-NEW
-// RUN: %run %t u1 2>&1 | FileCheck %s --check-prefix=CHECK-UPCAST
-// RUN: %env_ubsan_opts=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-STACK-LOAD
-
-// RUN: %clangxx -fsanitize=alignment -fno-sanitize-recover=alignment %s -O3 -o %t
-// RUN: not %run %t w1 2>&1 | FileCheck %s --check-prefix=CHECK-WILD
-// Compilation error make the test fails.
-// XFAIL: openbsd
-
-#include <new>
-
-struct S {
- S() {}
- int f() { return 0; }
- int k;
-};
-
-struct T : S {
- int t;
-};
-
-int main(int, char **argv) {
- char c[] __attribute__((aligned(8))) = { 0, 0, 0, 0, 1, 2, 3, 4, 5 };
-
- // Pointer value may be unspecified here, but behavior is not undefined.
- int *p = (int*)&c[4 + argv[1][1] - '0'];
- S *s = (S*)p;
- T *t = (T*)p;
-
- void *wild = reinterpret_cast<void *>(0x123L);
-
- (void)*p; // ok!
-
- switch (argv[1][0]) {
- case 'l':
- // CHECK-LOAD: misaligned.cpp:[[@LINE+4]]{{(:12)?}}: runtime error: load of misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment
- // CHECK-LOAD-NEXT: [[PTR]]: note: pointer points here
- // CHECK-LOAD-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-LOAD-NEXT: {{^ \^}}
- return *p && 0;
- // CHECK-STACK-LOAD: #0 {{.*}}main{{.*}}misaligned.cpp
-
- case 's':
- // CHECK-STORE: misaligned.cpp:[[@LINE+4]]{{(:5)?}}: runtime error: store to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment
- // CHECK-STORE-NEXT: [[PTR]]: note: pointer points here
- // CHECK-STORE-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-STORE-NEXT: {{^ \^}}
- *p = 1;
- break;
-
- case 'r':
- // CHECK-REFERENCE: misaligned.cpp:[[@LINE+4]]{{(:(5|15))?}}: runtime error: reference binding to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment
- // CHECK-REFERENCE-NEXT: [[PTR]]: note: pointer points here
- // CHECK-REFERENCE-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-REFERENCE-NEXT: {{^ \^}}
- {int &r = *p;}
- break;
-
- case 'm':
- // CHECK-MEMBER: misaligned.cpp:[[@LINE+4]]{{(:15)?}}: runtime error: member access within misaligned address [[PTR:0x[0-9a-f]*]] for type 'S', which requires 4 byte alignment
- // CHECK-MEMBER-NEXT: [[PTR]]: note: pointer points here
- // CHECK-MEMBER-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-MEMBER-NEXT: {{^ \^}}
- return s->k && 0;
-
- case 'f':
- // CHECK-MEMFUN: misaligned.cpp:[[@LINE+4]]{{(:15)?}}: runtime error: member call on misaligned address [[PTR:0x[0-9a-f]*]] for type 'S', which requires 4 byte alignment
- // CHECK-MEMFUN-NEXT: [[PTR]]: note: pointer points here
- // CHECK-MEMFUN-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-MEMFUN-NEXT: {{^ \^}}
- return s->f() && 0;
-
- case 'n':
- // CHECK-NEW: misaligned.cpp:[[@LINE+4]]{{(:21)?}}: runtime error: constructor call on misaligned address [[PTR:0x[0-9a-f]*]] for type 'S', which requires 4 byte alignment
- // CHECK-NEW-NEXT: [[PTR]]: note: pointer points here
- // CHECK-NEW-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-NEW-NEXT: {{^ \^}}
- return (new (s) S)->k && 0;
-
- case 'u': {
- // CHECK-UPCAST: misaligned.cpp:[[@LINE+4]]{{(:17)?}}: runtime error: upcast of misaligned address [[PTR:0x[0-9a-f]*]] for type 'T', which requires 4 byte alignment
- // CHECK-UPCAST-NEXT: [[PTR]]: note: pointer points here
- // CHECK-UPCAST-NEXT: {{^ 00 00 00 01 02 03 04 05}}
- // CHECK-UPCAST-NEXT: {{^ \^}}
- S *s2 = (S*)t;
- return s2->f();
- }
-
- case 'w':
- // CHECK-WILD: misaligned.cpp:[[@LINE+3]]{{(:35)?}}: runtime error: member access within misaligned address 0x{{0+}}123 for type 'S', which requires 4 byte alignment
- // CHECK-WILD-NEXT: 0x{{0+}}123: note: pointer points here
- // CHECK-WILD-NEXT: <memory cannot be printed>
- return static_cast<S*>(wild)->k;
- }
-}
diff --git a/test/ubsan/TestCases/TypeCheck/null.cpp b/test/ubsan/TestCases/TypeCheck/null.cpp
deleted file mode 100644
index 636fab82fd93..000000000000
--- a/test/ubsan/TestCases/TypeCheck/null.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// RUN: %clangxx -fsanitize=null -fno-sanitize-recover=null %s -O3 -o %t
-// RUN: not %run %t l 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD
-// RUN: not %run %t s 2>&1 | FileCheck %s --check-prefix=CHECK-STORE
-// RUN: not %run %t r 2>&1 | FileCheck %s --check-prefix=CHECK-REFERENCE
-// RUN: not %run %t m 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
-// RUN: not %run %t f 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
-// RUN: not %run %t t 2>&1 | FileCheck %s --check-prefix=CHECK-VCALL
-// RUN: not %run %t u 2>&1 | FileCheck %s --check-prefix=CHECK-VCALL2
-
-struct S {
- int f() { return 0; }
- int k;
-};
-
-struct T {
- virtual int v() { return 1; }
-};
-
-struct U : T {
- virtual int v() { return 2; }
-};
-
-int main(int, char **argv) {
- int *p = 0;
- S *s = 0;
- T *t = 0;
- U *u = 0;
-
- (void)*p; // ok!
- (void)*t; // ok!
- (void)*u; // ok!
-
- switch (argv[1][0]) {
- case 'l':
- // CHECK-LOAD: null.cpp:[[@LINE+1]]:12: runtime error: load of null pointer of type 'int'
- return *p;
- case 's':
- // CHECK-STORE: null.cpp:[[@LINE+1]]:5: runtime error: store to null pointer of type 'int'
- *p = 1;
- break;
- case 'r':
- // CHECK-REFERENCE: null.cpp:[[@LINE+1]]:15: runtime error: reference binding to null pointer of type 'int'
- {int &r = *p;}
- break;
- case 'm':
- // CHECK-MEMBER: null.cpp:[[@LINE+1]]:15: runtime error: member access within null pointer of type 'S'
- return s->k;
- case 'f':
- // CHECK-MEMFUN: null.cpp:[[@LINE+1]]:15: runtime error: member call on null pointer of type 'S'
- return s->f();
- case 't':
- // CHECK-VCALL: null.cpp:[[@LINE+1]]:15: runtime error: member call on null pointer of type 'T'
- return t->v();
- case 'u':
- // CHECK-VCALL2: null.cpp:[[@LINE+1]]:15: runtime error: member call on null pointer of type 'U'
- return u->v();
- }
-}
diff --git a/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp b/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
deleted file mode 100644
index fd1e7ed779a6..000000000000
--- a/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr,null -g %s -O3 -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-CORRUPTED-VTABLE --strict-whitespace
-
-// UNSUPPORTED: windows-msvc
-// REQUIRES: stable-runtime, cxxabi
-#include <cstddef>
-
-#include <typeinfo>
-
-struct S {
- S() {}
- ~S() {}
- virtual int v() { return 0; }
-};
-
-// See the proper definition in ubsan_type_hash_itanium.cc
-struct VtablePrefix {
- signed long Offset;
- std::type_info *TypeInfo;
-};
-
-int main(int argc, char **argv) {
- // Test that we don't crash on corrupted vtable when
- // offset is too large or too small.
- S Obj;
- void *Ptr = &Obj;
- VtablePrefix* RealPrefix = reinterpret_cast<VtablePrefix*>(
- *reinterpret_cast<void**>(Ptr)) - 1;
-
- VtablePrefix Prefix[2];
- Prefix[0].Offset = 1<<21; // Greater than VptrMaxOffset
- Prefix[0].TypeInfo = RealPrefix->TypeInfo;
-
- // Hack Vtable ptr for Obj.
- *reinterpret_cast<void**>(Ptr) = static_cast<void*>(&Prefix[1]);
-
- // CHECK-CORRUPTED-VTABLE: vptr-corrupted-vtable-itanium.cpp:[[@LINE+3]]:16: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'S'
- // CHECK-CORRUPTED-VTABLE-NEXT: [[PTR]]: note: object has a possibly invalid vptr: abs(offset to top) too big
- S* Ptr2 = reinterpret_cast<S*>(Ptr);
- return Ptr2->v();
-}
diff --git a/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp b/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp
deleted file mode 100644
index 13b05238610e..000000000000
--- a/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -fPIC -shared -o %dynamiclib -DBUILD_SO %ld_flags_rpath_so
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -O3 -o %t %ld_flags_rpath_exe
-// RUN: %run %t
-//
-// REQUIRES: cxxabi
-// UNSUPPORTED: windows-msvc
-// XFAIL: i386-netbsd
-
-struct X {
- virtual ~X() {}
-};
-X *libCall();
-
-#ifdef BUILD_SO
-
-X *libCall() {
- return new X;
-}
-
-#else
-
-int main() {
- X *px = libCall();
- delete px;
-}
-
-#endif
diff --git a/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp b/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp
deleted file mode 100644
index 75a5d7670fb9..000000000000
--- a/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr %s -o %t
-// RUN: %run %t
-
-// REQUIRES: cxxabi
-// UNSUPPORTED: windows-msvc
-
-int volatile n;
-
-struct A { virtual ~A() {} };
-struct B: virtual A {};
-struct C: virtual A { ~C() { n = 0; } };
-struct D: virtual B, virtual C {};
-
-int main() { delete new D; }
diff --git a/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp b/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
deleted file mode 100644
index 925373bdee1f..000000000000
--- a/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// RUN: %clangxx -frtti -fsanitize=null,vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
-// RUN: not %run %t 2>&1 | FileCheck %s
-
-// REQUIRES: cxxabi
-// UNSUPPORTED: windows-msvc
-// Nested crash reported
-// UNSUPPORTED: freebsd
-
-struct S { virtual int f() { return 0; } };
-struct T : virtual S {};
-
-struct Foo { virtual int f() { return 0; } };
-
-int main(int argc, char **argv) {
- Foo foo;
- T *t = (T*)&foo;
- S *s = t;
- // CHECK: vptr-virtual-base.cpp:[[@LINE-1]]:10: runtime error: cast to virtual base of address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-NEXT: [[PTR]]: note: object is of type 'Foo'
- return s->f();
-}
diff --git a/test/ubsan/TestCases/TypeCheck/vptr.cpp b/test/ubsan/TestCases/TypeCheck/vptr.cpp
deleted file mode 100644
index 67239e82d340..000000000000
--- a/test/ubsan/TestCases/TypeCheck/vptr.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-// RUN: %clangxx -frtti -fsanitize=null,vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rT
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t mT
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t fT
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t cT
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rU
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t mU
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t fU
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t cU
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rS
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t rV
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t oV
-// RUN: %env_ubsan_opts=halt_on_error=1 %run %t zN
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1:print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
-// RUN: %env_ubsan_opts=halt_on_error=1 not %run %t nN 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMFUN --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 %run %t dT 2>&1 | FileCheck %s --check-prefix=CHECK-DYNAMIC --check-prefix=CHECK-%os-DYNAMIC --strict-whitespace
-
-// RUN: (echo "vptr_check:S"; echo "vptr_check:T"; echo "vptr_check:U") > %t.supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t mS
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t fS
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t cS
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t mV
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t fV
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t cV
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t oU
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.supp"' %run %t dT
-
-// RUN: echo "vptr_check:S" > %t.loc-supp
-// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.loc-supp"' not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS
-
-// REQUIRES: stable-runtime, cxxabi
-// UNSUPPORTED: windows-msvc
-// Suppressions file not pushed to the device.
-// UNSUPPORTED: android
-// Compilation error
-// UNSUPPORTED: openbsd
-// Compilation error
-// UNSUPPORTED: freebsd
-#include <new>
-#include <typeinfo>
-#include <assert.h>
-#include <stdio.h>
-
-struct S {
- S() : a(0) {}
- ~S();
- int a;
- int f() { return 0; }
- virtual int v() { return 0; }
-};
-
-struct T : S {
- T() : b(0) {}
- int b;
- int g() { return 0; }
- virtual int v() { return 1; }
-};
-
-struct U : S, T { virtual int v() { return 2; } };
-
-struct V : S {};
-
-namespace {
- struct W {};
-}
-
-T *p = 0;
-
-bool dtorCheck = false;
-
-volatile void *sink1, *sink2;
-
-int access_p(T *p, char type);
-
-S::~S() {
- if (dtorCheck)
- access_p(p, '~');
-}
-
-int main(int argc, char **argv) {
- assert(argc > 1);
- fprintf(stderr, "Test case: %s\n", argv[1]);
- T t;
- (void)t.a;
- (void)t.b;
- (void)t.f();
- (void)t.g();
- (void)t.v();
- (void)t.S::v();
-
- U u;
- (void)u.T::a;
- (void)u.b;
- (void)u.T::f();
- (void)u.g();
- (void)u.v();
- (void)u.T::v();
- (void)((T&)u).S::v();
-
- char Buffer[sizeof(U)] = {};
- char TStorage[sizeof(T)];
- // Allocate two dummy objects so that the real object
- // is not on the boundary of mapped memory. Otherwise ubsan
- // will not be able to describe the vptr in detail.
- sink1 = new T;
- sink2 = new U;
- switch (argv[1][1]) {
- case '0':
- p = reinterpret_cast<T*>(Buffer);
- break;
- case 'S':
- // Make sure p points to the memory chunk of sufficient size to prevent ASan
- // reports about out-of-bounds access.
- p = reinterpret_cast<T*>(new(TStorage) S);
- break;
- case 'T':
- p = new T;
- break;
- case 'U':
- p = new U;
- break;
- case 'V':
- p = reinterpret_cast<T*>(new U);
- break;
- case 'N':
- p = 0;
- break;
- }
-
- access_p(p, argv[1][0]);
- return 0;
-}
-
-int access_p(T *p, char type) {
- switch (type) {
- case 'r':
- // Binding a reference to storage of appropriate size and alignment is OK.
- {T &r = *p;}
- return 0;
-
- case 'x':
- for (int i = 0; i < 2; i++) {
- // Check that the first iteration ("S") succeeds, while the second ("V") fails.
- p = reinterpret_cast<T*>((i == 0) ? new S : new V);
- // CHECK-LOC-SUPPRESS: vptr.cpp:[[@LINE+5]]:10: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-LOC-SUPPRESS-NEXT: [[PTR]]: note: object is of type 'V'
- // CHECK-LOC-SUPPRESS-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-LOC-SUPPRESS-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-LOC-SUPPRESS-NEXT: {{^ vptr for 'V'}}
- p->g();
- }
- return 0;
-
- case 'm':
- // CHECK-MEMBER: vptr.cpp:[[@LINE+6]]:15: runtime error: member access within address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-MEMBER-NEXT: [[PTR]]: note: object is of type [[DYN_TYPE:'S'|'U']]
- // CHECK-MEMBER-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-MEMBER-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-MEMBER-NEXT: {{^ vptr for}} [[DYN_TYPE]]
- // CHECK-Linux-MEMBER: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- return p->b;
-
- // CHECK-INVALID-MEMBER: vptr.cpp:[[@LINE-2]]:15: runtime error: member access within address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-INVALID-MEMBER-NEXT: [[PTR]]: note: object has invalid vptr
- // CHECK-INVALID-MEMBER-NEXT: {{^ ?.. .. .. .. ?00 00 00 00 ?00 00 00 00 ?}}
- // CHECK-INVALID-MEMBER-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-INVALID-MEMBER-NEXT: {{^ invalid vptr}}
- // CHECK-Linux-NULL-MEMBER: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE-7]]
-
- case 'f':
- // CHECK-MEMFUN: vptr.cpp:[[@LINE+6]]:15: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-MEMFUN-NEXT: [[PTR]]: note: object is of type [[DYN_TYPE:'S'|'U']]
- // CHECK-MEMFUN-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-MEMFUN-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-MEMFUN-NEXT: {{^ vptr for}} [[DYN_TYPE]]
- // TODO: Add check for stacktrace here.
- return p->g();
-
- case 'o':
- // CHECK-OFFSET: vptr.cpp:[[@LINE+6]]:37: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'U'
- // CHECK-OFFSET-NEXT: 0x{{[0-9a-f]*}}: note: object is base class subobject at offset {{8|16}} within object of type [[DYN_TYPE:'U']]
- // CHECK-OFFSET-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-OFFSET-NEXT: {{^ \^ ( ~~~~~~~~~~~~)?~~~~~~~~~~~ *$}}
- // CHECK-OFFSET-NEXT: {{^ ( )?vptr for}} 'T' base class of [[DYN_TYPE]]
- // CHECK-Linux-OFFSET: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- return reinterpret_cast<U*>(p)->v() - 2;
-
- case 'c':
- // CHECK-DOWNCAST: vptr.cpp:[[@LINE+6]]:11: runtime error: downcast of address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-DOWNCAST-NEXT: [[PTR]]: note: object is of type [[DYN_TYPE:'S'|'U']]
- // CHECK-DOWNCAST-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-DOWNCAST-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-DOWNCAST-NEXT: {{^ vptr for}} [[DYN_TYPE]]
- // CHECK-Linux-DOWNCAST: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- (void)static_cast<T*>(reinterpret_cast<S*>(p));
- return 0;
-
- case 'n':
- // CHECK-NULL-MEMFUN: vptr.cpp:[[@LINE+1]]:15: runtime error: member call on null pointer of type 'T'
- return p->g();
-
- case 'd':
- dtorCheck = true;
- delete p;
- dtorCheck = false;
- return 0;
- case '~':
- // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:11: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S'
- // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S'
- // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- (void)dynamic_cast<V*>(p);
- // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:11: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S'
- // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S'
- // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- (void)dynamic_cast<W*>(p);
- try {
- // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:13: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S'
- // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S'
- // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- (void)dynamic_cast<V&>(*p);
- } catch (std::bad_cast &) {}
- // CHECK-DYNAMIC: vptr.cpp:[[@LINE+6]]:18: runtime error: dynamic operation on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
- // CHECK-DYNAMIC-NEXT: [[PTR]]: note: object is of type 'S'
- // CHECK-DYNAMIC-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
- // CHECK-DYNAMIC-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
- // CHECK-DYNAMIC-NEXT: {{^ vptr for}} 'S'
- // CHECK-Linux-DYNAMIC: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
- (void)typeid(*p);
- return 0;
-
- case 'z':
- (void)dynamic_cast<V*>(p);
- try {
- (void)typeid(*p);
- } catch (std::bad_typeid &) {}
- return 0;
- }
- return 0;
-}