Richard Smith | c4dabad | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 1 | // RUN: %clang -target x86_64-linux-gnu -fcatch-undefined-behavior %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED |
| 2 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED |
Richard Smith | 463b48b | 2012-12-13 07:11:50 +0000 | [diff] [blame] | 3 | // CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|bounds|enum|bool),?){15}"}} |
Richard Smith | c4dabad | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 4 | |
Will Dietz | b854036 | 2012-11-27 15:01:55 +0000 | [diff] [blame] | 5 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=integer %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INTEGER |
| 6 | // CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift),?){4}"}} |
| 7 | |
Richard Smith | 463b48b | 2012-12-13 07:11:50 +0000 | [diff] [blame] | 8 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread,undefined -fno-thread-sanitizer -fno-sanitize=float-cast-overflow,vptr,bool,enum %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-UNDEFINED |
Will Dietz | b854036 | 2012-11-27 15:01:55 +0000 | [diff] [blame] | 9 | // CHECK-PARTIAL-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|object-size|bounds),?){11}"}} |
Richard Smith | c4dabad | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 10 | |
Alexey Samsonov | 4d1a6e4 | 2012-11-29 22:36:21 +0000 | [diff] [blame] | 11 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address-full %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FULL |
| 12 | // CHECK-ASAN-FULL: "-fsanitize={{((address|init-order|use-after-return|use-after-scope),?){4}"}} |
| 13 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 14 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI |
| 15 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI |
Richard Smith | 04fd382 | 2012-11-06 01:12:02 +0000 | [diff] [blame] | 16 | // CHECK-VPTR-NO-RTTI: '-fsanitize=vptr' not allowed with '-fno-rtti' |
Richard Smith | c4dabad | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 17 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 18 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT |
Richard Smith | c4dabad | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 19 | // CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread' |
| 20 | |
Evgeniy Stepanov | 34ef11b | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 21 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANM |
Evgeniy Stepanov | 99469f7 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 22 | // CHECK-SANA-SANM: '-fsanitize=address' not allowed with '-fsanitize=memory' |
| 23 | |
Evgeniy Stepanov | 34ef11b | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 24 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANT-SANM |
Evgeniy Stepanov | 99469f7 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 25 | // CHECK-SANT-SANM: '-fsanitize=thread' not allowed with '-fsanitize=memory' |
| 26 | |
Evgeniy Stepanov | 34ef11b | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 27 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory,thread -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANM-SANT |
Evgeniy Stepanov | 99469f7 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 28 | // CHECK-SANM-SANT: '-fsanitize=thread' not allowed with '-fsanitize=memory' |
| 29 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 30 | // RUN: %clang -target x86_64-linux-gnu -faddress-sanitizer -fthread-sanitizer -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TSAN |
Richard Smith | 04fd382 | 2012-11-06 01:12:02 +0000 | [diff] [blame] | 31 | // CHECK-ASAN-TSAN: '-faddress-sanitizer' not allowed with '-fthread-sanitizer' |
| 32 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 33 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=init-order %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-EXTRA-ASAN |
Alexey Samsonov | 3e335c1 | 2013-01-28 07:20:44 +0000 | [diff] [blame] | 34 | // CHECK-ONLY-EXTRA-ASAN: '-fsanitize=init-order' is ignored in absence of '-fsanitize=address' |
| 35 | |
| 36 | // RUN: %clang -target x86_64-linux-gnu -Wno-unused-sanitize-argument -fsanitize=init-order %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-WNO-UNUSED-SANITIZE-ARGUMENT |
| 37 | // CHECK-WNO-UNUSED-SANITIZE-ARGUMENT-NOT: '-fsanitize=init-order' is ignored in absence of '-fsanitize=address' |
| 38 | |
| 39 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,init-order -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NOWARN-ONLY-EXTRA-ASAN |
| 40 | // CHECK-NOWARN-ONLY-EXTRA-ASAN-NOT: is ignored in absence of '-fsanitize=address' |
Alexey Samsonov | 4d1a6e4 | 2012-11-29 22:36:21 +0000 | [diff] [blame] | 41 | |
Evgeniy Stepanov | 34ef11b | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 42 | // RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS |
| 43 | // CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins' |
| 44 | |
Alexey Samsonov | a40548c | 2013-01-16 11:34:36 +0000 | [diff] [blame] | 45 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTRA-TRACK-ORIGINS |
| 46 | // CHECK-NO-EXTRA-TRACK-ORIGINS-NOT: "-fsanitize-memory-track-origins" |
| 47 | |
Alexey Samsonov | 4bdc604 | 2013-01-20 13:12:12 +0000 | [diff] [blame] | 48 | // RUN: %clang -target x86_64-linux-gnu -fsanitize-address-zero-base-shadow -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-ASAN-ZERO-BASE-SHADOW |
| 49 | // CHECK-ONLY-ASAN-ZERO-BASE-SHADOW: warning: argument unused during compilation: '-fsanitize-address-zero-base-shadow' |
| 50 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 51 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize=alignment -fsanitize=vptr -fno-sanitize=vptr %s -### 2>&1 |
Richard Smith | 0565037 | 2012-12-01 01:02:45 +0000 | [diff] [blame] | 52 | // OK |
Alexey Samsonov | 3325b16 | 2012-11-28 17:34:24 +0000 | [diff] [blame] | 53 | |
Evgeniy Stepanov | 34ef11b | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 54 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -pie %s -### 2>&1 |
| 55 | // OK |
| 56 | |
| 57 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -pie %s -### 2>&1 |
| 58 | // OK |
| 59 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 60 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 |
Richard Smith | 0565037 | 2012-12-01 01:02:45 +0000 | [diff] [blame] | 61 | // OK |
Alexey Samsonov | 3325b16 | 2012-11-28 17:34:24 +0000 | [diff] [blame] | 62 | |
Alexey Samsonov | 4bdc604 | 2013-01-20 13:12:12 +0000 | [diff] [blame] | 63 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-zero-base-shadow -pie %s -### 2>&1 |
| 64 | // OK |
| 65 | |
Joey Gouly | 4247d9c | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 66 | // RUN: %clang -target x86_64-linux-gnu -fcatch-undefined-behavior -fthread-sanitizer -fno-thread-sanitizer -faddress-sanitizer -fno-address-sanitizer -fbounds-checking -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEPRECATED |
Richard Smith | 04fd382 | 2012-11-06 01:12:02 +0000 | [diff] [blame] | 67 | // CHECK-DEPRECATED: argument '-fcatch-undefined-behavior' is deprecated, use '-fsanitize=undefined' instead |
| 68 | // CHECK-DEPRECATED: argument '-fthread-sanitizer' is deprecated, use '-fsanitize=thread' instead |
| 69 | // CHECK-DEPRECATED: argument '-fno-thread-sanitizer' is deprecated, use '-fno-sanitize=thread' instead |
| 70 | // CHECK-DEPRECATED: argument '-faddress-sanitizer' is deprecated, use '-fsanitize=address' instead |
| 71 | // CHECK-DEPRECATED: argument '-fno-address-sanitizer' is deprecated, use '-fno-sanitize=address' instead |
Joey Gouly | 8548908 | 2012-11-23 10:39:49 +0000 | [diff] [blame] | 72 | // CHECK-DEPRECATED: argument '-fbounds-checking' is deprecated, use '-fsanitize=bounds' instead |
Evgeniy Stepanov | 99469f7 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 73 | |
| 74 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-NO-PIE |
| 75 | // CHECK-TSAN-NO-PIE: invalid argument '-fsanitize=thread' only allowed with '-pie' |
| 76 | |
| 77 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NO-PIE |
| 78 | // CHECK-MSAN-NO-PIE: invalid argument '-fsanitize=memory' only allowed with '-pie' |
| 79 | |
Alexey Samsonov | 4bdc604 | 2013-01-20 13:12:12 +0000 | [diff] [blame] | 80 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-zero-base-shadow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ZERO-BASE-SHADOW-NO-PIE |
| 81 | // CHECK-ASAN-ZERO-BASE-SHADOW-NO-PIE: invalid argument '-fsanitize-address-zero-base-shadow' only allowed with '-pie' |
| 82 | |
| 83 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-zero-base-shadow -fno-sanitize-address-zero-base-shadow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ZERO-BASE-SHADOW-CANCEL |
| 84 | // CHECK-ASAN-ZERO-BASE-SHADOW-CANCEL-NOT: '-fsanitize-address-zero-base-shadow' only allowed with '-pie' |
| 85 | |
Evgeniy Stepanov | 99469f7 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 86 | // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-ASAN-NO-PIE |
| 87 | // CHECK-ANDROID-ASAN-NO-PIE: AddressSanitizer on Android requires '-pie' |
Will Dietz | 2d382d1 | 2012-12-30 20:53:28 +0000 | [diff] [blame] | 88 | |
| 89 | // RUN: %clang -target x86_64-linux-gnu %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER |
| 90 | // RUN: %clang -target x86_64-linux-gnu %s -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER |
| 91 | // RUN: %clang -target x86_64-linux-gnu %s -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER |
| 92 | // RUN: %clang -target x86_64-linux-gnu %s -fno-sanitize-recover -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER |
| 93 | // RUN: %clang -target x86_64-linux-gnu %s -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER |
| 94 | // CHECK-RECOVER-NOT: sanitize-recover |
| 95 | // CHECK-NO-RECOVER: "-fno-sanitize-recover" |