Chad Rosier | ae229d5 | 2013-01-29 23:31:22 +0000 | [diff] [blame] | 1 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP |
| 2 | // RUN: %clang -target x86_64-linux-gnu -fsanitize-undefined-trap-on-error -fsanitize=undefined-trap %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP |
Alexey Samsonov | de443c5 | 2014-08-13 00:26:40 +0000 | [diff] [blame] | 3 | // CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute),?){15}"}} |
Chad Rosier | ae229d5 | 2013-01-29 23:31:22 +0000 | [diff] [blame] | 4 | // CHECK-UNDEFINED-TRAP: "-fsanitize-undefined-trap-on-error" |
| 5 | |
Richard Smith | 52be619 | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 6 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED |
Alexey Samsonov | de443c5 | 2014-08-13 00:26:40 +0000 | [diff] [blame] | 7 | // CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute),?){17}"}} |
Richard Smith | 52be619 | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 8 | |
Peter Collingbourne | 3270164 | 2013-11-01 18:16:25 +0000 | [diff] [blame] | 9 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN |
Alexey Samsonov | de443c5 | 2014-08-13 00:26:40 +0000 | [diff] [blame] | 10 | // CHECK-UNDEFINED-DARWIN: "-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|array-bounds|enum|bool|returns-nonnull-attribute),?){16}"}} |
Peter Collingbourne | 3270164 | 2013-11-01 18:16:25 +0000 | [diff] [blame] | 11 | |
Will Dietz | 1897cb3 | 2012-11-27 15:01:55 +0000 | [diff] [blame] | 12 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=integer %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INTEGER |
| 13 | // CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift),?){4}"}} |
| 14 | |
Alexey Samsonov | e123799 | 2014-03-21 07:15:47 +0000 | [diff] [blame] | 15 | // RUN: %clang -fsanitize=bounds -### -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=CHECK-BOUNDS |
| 16 | // CHECK-BOUNDS: "-fsanitize={{((array-bounds|local-bounds),?){2}"}} |
| 17 | |
Alexey Samsonov | cb3f812 | 2014-03-20 10:48:29 +0000 | [diff] [blame] | 18 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread,undefined -fno-sanitize=thread -fno-sanitize=float-cast-overflow,vptr,bool,enum %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-UNDEFINED |
Alexey Samsonov | de443c5 | 2014-08-13 00:26:40 +0000 | [diff] [blame] | 19 | // CHECK-PARTIAL-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift|unreachable|return|vla-bound|alignment|null|object-size|array-bounds|returns-nonnull-attribute),?){13}"}} |
Richard Smith | 52be619 | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 20 | |
Chad Rosier | ae229d5 | 2013-01-29 23:31:22 +0000 | [diff] [blame] | 21 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP-ON-ERROR-UNDEF |
| 22 | // CHECK-UNDEFINED-TRAP-ON-ERROR-UNDEF: '-fsanitize=undefined' not allowed with '-fsanitize-undefined-trap-on-error' |
| 23 | |
| 24 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP-ON-ERROR-VPTR |
| 25 | // CHECK-UNDEFINED-TRAP-ON-ERROR-VPTR: '-fsanitize=vptr' not allowed with '-fsanitize-undefined-trap-on-error' |
| 26 | |
Joey Gouly | a35a289 | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 27 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI |
| 28 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI |
Richard Smith | aa71657 | 2012-11-06 01:12:02 +0000 | [diff] [blame] | 29 | // CHECK-VPTR-NO-RTTI: '-fsanitize=vptr' not allowed with '-fno-rtti' |
Richard Smith | 52be619 | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 30 | |
Joey Gouly | a35a289 | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 31 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT |
Richard Smith | 52be619 | 2012-11-05 22:04:41 +0000 | [diff] [blame] | 32 | // CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread' |
| 33 | |
Evgeniy Stepanov | ad8ab3d | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 34 | // 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 | cdc2255 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 35 | // CHECK-SANA-SANM: '-fsanitize=address' not allowed with '-fsanitize=memory' |
| 36 | |
Evgeniy Stepanov | ad8ab3d | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 37 | // 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 | cdc2255 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 38 | // CHECK-SANT-SANM: '-fsanitize=thread' not allowed with '-fsanitize=memory' |
| 39 | |
Evgeniy Stepanov | ad8ab3d | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 40 | // 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 | cdc2255 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 41 | // CHECK-SANM-SANT: '-fsanitize=thread' not allowed with '-fsanitize=memory' |
| 42 | |
Sergey Matveev | 1814e9e | 2013-05-27 11:17:01 +0000 | [diff] [blame] | 43 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak,thread -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-SANT |
| 44 | // CHECK-SANL-SANT: '-fsanitize=leak' not allowed with '-fsanitize=thread' |
| 45 | |
| 46 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-SANM |
| 47 | // CHECK-SANL-SANM: '-fsanitize=leak' not allowed with '-fsanitize=memory' |
| 48 | |
Evgeniy Stepanov | ad8ab3d | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 49 | // RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS |
| 50 | // CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins' |
| 51 | |
Alexey Samsonov | f7a2476 | 2013-01-16 11:34:36 +0000 | [diff] [blame] | 52 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTRA-TRACK-ORIGINS |
| 53 | // CHECK-NO-EXTRA-TRACK-ORIGINS-NOT: "-fsanitize-memory-track-origins" |
| 54 | |
Joey Gouly | a35a289 | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 55 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize=alignment -fsanitize=vptr -fno-sanitize=vptr %s -### 2>&1 |
Richard Smith | 06d87f1 | 2012-12-01 01:02:45 +0000 | [diff] [blame] | 56 | // OK |
Alexey Samsonov | 53f7e12 | 2012-11-28 17:34:24 +0000 | [diff] [blame] | 57 | |
Evgeniy Stepanov | ad8ab3d | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 58 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -pie %s -### 2>&1 |
| 59 | // OK |
| 60 | |
Evgeniy Stepanov | 2bfcaab | 2014-03-20 14:58:36 +0000 | [diff] [blame] | 61 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 |
| 62 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=1 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 |
| 63 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 |
| 64 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fno-sanitize-memory-track-origins -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 |
| 65 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=0 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 |
| 66 | |
| 67 | // CHECK-TRACK-ORIGINS-1: -fsanitize-memory-track-origins=1 |
| 68 | |
| 69 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fno-sanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TRACK-ORIGINS |
| 70 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=0 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TRACK-ORIGINS |
| 71 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -fno-sanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TRACK-ORIGINS |
| 72 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -fsanitize-memory-track-origins=0 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TRACK-ORIGINS |
| 73 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-sanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TRACK-ORIGINS |
| 74 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-memory-track-origins=0 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TRACK-ORIGINS |
| 75 | // CHECK-NO-TRACK-ORIGINS-NOT: sanitize-memory-track-origins |
| 76 | |
| 77 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=2 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-2 |
| 78 | // CHECK-TRACK-ORIGINS-2: -fsanitize-memory-track-origins=2 |
| 79 | |
| 80 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=3 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-3 |
| 81 | // CHECK-TRACK-ORIGINS-3: error: invalid value '3' in '-fsanitize-memory-track-origins=3' |
Evgeniy Stepanov | ad8ab3d | 2012-12-24 08:42:34 +0000 | [diff] [blame] | 82 | |
Joey Gouly | a35a289 | 2012-12-01 13:07:22 +0000 | [diff] [blame] | 83 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 |
Richard Smith | 06d87f1 | 2012-12-01 01:02:45 +0000 | [diff] [blame] | 84 | // OK |
Alexey Samsonov | 53f7e12 | 2012-11-28 17:34:24 +0000 | [diff] [blame] | 85 | |
Evgeniy Stepanov | cdc2255 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 86 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-NO-PIE |
Peter Collingbourne | 54d770c | 2013-04-09 04:35:11 +0000 | [diff] [blame] | 87 | // CHECK-TSAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" |
| 88 | // CHECK-TSAN-NO-PIE: "-pie" |
Evgeniy Stepanov | cdc2255 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 89 | |
| 90 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NO-PIE |
Peter Collingbourne | 54d770c | 2013-04-09 04:35:11 +0000 | [diff] [blame] | 91 | // CHECK-MSAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" |
| 92 | // CHECK-MSAN-NO-PIE: "-pie" |
Evgeniy Stepanov | cdc2255 | 2012-12-05 13:37:12 +0000 | [diff] [blame] | 93 | |
| 94 | // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-ASAN-NO-PIE |
Peter Collingbourne | 54d770c | 2013-04-09 04:35:11 +0000 | [diff] [blame] | 95 | // CHECK-ANDROID-ASAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" |
| 96 | // CHECK-ANDROID-ASAN-NO-PIE: "-pie" |
Will Dietz | 3676d56 | 2012-12-30 20:53:28 +0000 | [diff] [blame] | 97 | |
Alexey Samsonov | 71c197b | 2013-08-09 10:56:42 +0000 | [diff] [blame] | 98 | // RUN: %clang -target arm-linux-androideabi %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-NO-ASAN |
Alexey Bataev | 40e7522 | 2014-01-28 06:30:35 +0000 | [diff] [blame] | 99 | // CHECK-ANDROID-NO-ASAN: "-mrelocation-model" "pic" |
Alexey Samsonov | 71c197b | 2013-08-09 10:56:42 +0000 | [diff] [blame] | 100 | |
Will Dietz | 3676d56 | 2012-12-30 20:53:28 +0000 | [diff] [blame] | 101 | // RUN: %clang -target x86_64-linux-gnu %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER |
| 102 | // RUN: %clang -target x86_64-linux-gnu %s -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER |
| 103 | // RUN: %clang -target x86_64-linux-gnu %s -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER |
| 104 | // RUN: %clang -target x86_64-linux-gnu %s -fno-sanitize-recover -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER |
| 105 | // RUN: %clang -target x86_64-linux-gnu %s -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER |
| 106 | // CHECK-RECOVER-NOT: sanitize-recover |
| 107 | // CHECK-NO-RECOVER: "-fno-sanitize-recover" |
Sergey Matveev | 1814e9e | 2013-05-27 11:17:01 +0000 | [diff] [blame] | 108 | |
| 109 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL |
| 110 | // CHECK-SANL: "-fsanitize=leak" |
| 111 | |
| 112 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,leak -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANL-NO-SANA |
| 113 | // CHECK-SANA-SANL-NO-SANA: "-fsanitize=leak" |
Evgeniy Stepanov | edc9142 | 2013-06-20 10:49:46 +0000 | [diff] [blame] | 114 | |
| 115 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN |
| 116 | // CHECK-MSAN: "-fno-assume-sane-operator-new" |
Alexey Samsonov | 609213f9 | 2013-08-19 09:14:21 +0000 | [diff] [blame] | 117 | |
| 118 | // RUN: %clang -target x86_64-linux-gnu -fsanitize=zzz %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG1 |
| 119 | // CHECK-DIAG1: unsupported argument 'zzz' to option 'fsanitize=' |
| 120 | // CHECK-DIAG1-NOT: unsupported argument 'zzz' to option 'fsanitize=' |
Peter Collingbourne | 3270164 | 2013-11-01 18:16:25 +0000 | [diff] [blame] | 121 | |
| 122 | // RUN: %clang -target i686-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-X86 |
| 123 | // CHECK-MSAN-X86: error: unsupported option '-fsanitize=memory' for target 'i686--linux-gnu' |
| 124 | |
| 125 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-DARWIN |
| 126 | // CHECK-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10' |
| 127 | |
| 128 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory -fno-sanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NOMSAN-DARWIN |
| 129 | // CHECK-MSAN-NOMSAN-DARWIN-NOT: unsupported option |
| 130 | |
| 131 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory -fsanitize=thread,memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-TSAN-MSAN-DARWIN |
| 132 | // CHECK-MSAN-TSAN-MSAN-DARWIN: unsupported option '-fsanitize=thread,memory' for target 'x86_64-apple-darwin10' |
| 133 | // CHECK-MSAN-TSAN-MSAN-DARWIN-NOT: unsupported option |
| 134 | |
| 135 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=thread,memory -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-MSAN-MSAN-DARWIN |
| 136 | // CHECK-TSAN-MSAN-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10' |
| 137 | // CHECK-TSAN-MSAN-MSAN-DARWIN: unsupported option '-fsanitize=thread' for target 'x86_64-apple-darwin10' |
| 138 | // CHECK-TSAN-MSAN-MSAN-DARWIN-NOT: unsupported option |
| 139 | |
| 140 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-DARWIN |
| 141 | // CHECK-FSAN-DARWIN: unsupported option '-fsanitize=function' for target 'x86_64-apple-darwin10' |
| 142 | |
| 143 | // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-DARWIN |
| 144 | // CHECK-FSAN-UBSAN-DARWIN: unsupported option '-fsanitize=function' for target 'x86_64-apple-darwin10' |