Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 1 | // RUN: %clang_dfsan %s -fsanitize-blacklist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && %run %t 2>&1 | FileCheck %s |
| 2 | // RUN: %clang_dfsan %s -fsanitize-blacklist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && DFSAN_OPTIONS=warn_unimplemented=0 %run %t 2>&1 | count 0 |
| 3 | // RUN: %clang_dfsan %s -fsanitize-blacklist=%S/Inputs/flags_abilist.txt -mllvm -dfsan-debug-nonzero-labels -o %t && DFSAN_OPTIONS=warn_nonzero_labels=1 %run %t 2>&1 | FileCheck --check-prefix=CHECK-NONZERO %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 4 | |
| 5 | // Tests that flags work correctly. |
| 6 | |
| 7 | #include <sanitizer/dfsan_interface.h> |
| 8 | |
| 9 | int f(int i) { |
| 10 | return i; |
| 11 | } |
| 12 | |
| 13 | int main(void) { |
| 14 | int i = 1; |
| 15 | dfsan_label i_label = dfsan_create_label("i", 0); |
| 16 | dfsan_set_label(i_label, &i, sizeof(i)); |
| 17 | |
| 18 | // CHECK: WARNING: DataFlowSanitizer: call to uninstrumented function f |
| 19 | // CHECK-NOT: WARNING: DataFlowSanitizer: saw nonzero label |
| 20 | // CHECK-NONZERO: WARNING: DataFlowSanitizer: saw nonzero label |
| 21 | f(i); |
| 22 | |
| 23 | return 0; |
| 24 | } |