blob: 857ae321ee44fecaea05c85a6276cdc5138f4c3b [file] [log] [blame]
Richard Smithc4dabad2012-11-05 22:04:41 +00001// 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 Smith463b48b2012-12-13 07:11:50 +00003// 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 Smithc4dabad2012-11-05 22:04:41 +00004
Will Dietzb8540362012-11-27 15:01:55 +00005// 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 Smith463b48b2012-12-13 07:11:50 +00008// 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 Dietzb8540362012-11-27 15:01:55 +00009// 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 Smithc4dabad2012-11-05 22:04:41 +000010
Alexey Samsonov4d1a6e42012-11-29 22:36:21 +000011// 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 Gouly4247d9c2012-12-01 13:07:22 +000014// 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 Smith04fd3822012-11-06 01:12:02 +000016// CHECK-VPTR-NO-RTTI: '-fsanitize=vptr' not allowed with '-fno-rtti'
Richard Smithc4dabad2012-11-05 22:04:41 +000017
Joey Gouly4247d9c2012-12-01 13:07:22 +000018// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT
Richard Smithc4dabad2012-11-05 22:04:41 +000019// CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread'
20
Evgeniy Stepanov34ef11b2012-12-24 08:42:34 +000021// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANM
Evgeniy Stepanov99469f72012-12-05 13:37:12 +000022// CHECK-SANA-SANM: '-fsanitize=address' not allowed with '-fsanitize=memory'
23
Evgeniy Stepanov34ef11b2012-12-24 08:42:34 +000024// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread,memory -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANT-SANM
Evgeniy Stepanov99469f72012-12-05 13:37:12 +000025// CHECK-SANT-SANM: '-fsanitize=thread' not allowed with '-fsanitize=memory'
26
Evgeniy Stepanov34ef11b2012-12-24 08:42:34 +000027// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory,thread -pie -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANM-SANT
Evgeniy Stepanov99469f72012-12-05 13:37:12 +000028// CHECK-SANM-SANT: '-fsanitize=thread' not allowed with '-fsanitize=memory'
29
Joey Gouly4247d9c2012-12-01 13:07:22 +000030// RUN: %clang -target x86_64-linux-gnu -faddress-sanitizer -fthread-sanitizer -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TSAN
Richard Smith04fd3822012-11-06 01:12:02 +000031// CHECK-ASAN-TSAN: '-faddress-sanitizer' not allowed with '-fthread-sanitizer'
32
Joey Gouly4247d9c2012-12-01 13:07:22 +000033// RUN: %clang -target x86_64-linux-gnu -fsanitize=init-order %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-EXTRA-ASAN
Alexey Samsonov4d1a6e42012-11-29 22:36:21 +000034// CHECK-ONLY-EXTRA-ASAN: argument '-fsanitize=init-order' only allowed with '-fsanitize=address'
35
Evgeniy Stepanov34ef11b2012-12-24 08:42:34 +000036// RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS
37// CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins'
38
Alexey Samsonova40548c2013-01-16 11:34:36 +000039// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTRA-TRACK-ORIGINS
40// CHECK-NO-EXTRA-TRACK-ORIGINS-NOT: "-fsanitize-memory-track-origins"
41
Joey Gouly4247d9c2012-12-01 13:07:22 +000042// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize=alignment -fsanitize=vptr -fno-sanitize=vptr %s -### 2>&1
Richard Smith05650372012-12-01 01:02:45 +000043// OK
Alexey Samsonov3325b162012-11-28 17:34:24 +000044
Evgeniy Stepanov34ef11b2012-12-24 08:42:34 +000045// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -pie %s -### 2>&1
46// OK
47
48// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -pie %s -### 2>&1
49// OK
50
Joey Gouly4247d9c2012-12-01 13:07:22 +000051// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1
Richard Smith05650372012-12-01 01:02:45 +000052// OK
Alexey Samsonov3325b162012-11-28 17:34:24 +000053
Joey Gouly4247d9c2012-12-01 13:07:22 +000054// 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 Smith04fd3822012-11-06 01:12:02 +000055// CHECK-DEPRECATED: argument '-fcatch-undefined-behavior' is deprecated, use '-fsanitize=undefined' instead
56// CHECK-DEPRECATED: argument '-fthread-sanitizer' is deprecated, use '-fsanitize=thread' instead
57// CHECK-DEPRECATED: argument '-fno-thread-sanitizer' is deprecated, use '-fno-sanitize=thread' instead
58// CHECK-DEPRECATED: argument '-faddress-sanitizer' is deprecated, use '-fsanitize=address' instead
59// CHECK-DEPRECATED: argument '-fno-address-sanitizer' is deprecated, use '-fno-sanitize=address' instead
Joey Gouly85489082012-11-23 10:39:49 +000060// CHECK-DEPRECATED: argument '-fbounds-checking' is deprecated, use '-fsanitize=bounds' instead
Evgeniy Stepanov99469f72012-12-05 13:37:12 +000061
62// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-NO-PIE
63// CHECK-TSAN-NO-PIE: invalid argument '-fsanitize=thread' only allowed with '-pie'
64
65// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NO-PIE
66// CHECK-MSAN-NO-PIE: invalid argument '-fsanitize=memory' only allowed with '-pie'
67
68// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-ASAN-NO-PIE
69// CHECK-ANDROID-ASAN-NO-PIE: AddressSanitizer on Android requires '-pie'
Will Dietz2d382d12012-12-30 20:53:28 +000070
71// RUN: %clang -target x86_64-linux-gnu %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER
72// RUN: %clang -target x86_64-linux-gnu %s -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER
73// RUN: %clang -target x86_64-linux-gnu %s -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER
74// RUN: %clang -target x86_64-linux-gnu %s -fno-sanitize-recover -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER
75// RUN: %clang -target x86_64-linux-gnu %s -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER
76// CHECK-RECOVER-NOT: sanitize-recover
77// CHECK-NO-RECOVER: "-fno-sanitize-recover"