Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_asan -O0 %s -o %t |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 2 | // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=SOURCE |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 3 | // RUN: %env_asan_opts=symbolize=false not %run %t 2>&1 | FileCheck %s --check-prefix=MODULE |
| 4 | // RUN: %env_asan_opts=print_summary=false not %run %t 2>&1 | FileCheck %s --check-prefix=MISSING |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 5 | |
| 6 | int main() { |
| 7 | char *x = new char[20]; |
| 8 | delete[] x; |
| 9 | return x[0]; |
Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 10 | // SOURCE: ERROR: AddressSanitizer: heap-use-after-free |
| 11 | // SOURCE: SUMMARY: AddressSanitizer: heap-use-after-free {{.*}}print_summary.cc:[[@LINE-2]]{{.*}} main |
| 12 | // MODULE: ERROR: AddressSanitizer: heap-use-after-free |
| 13 | // MODULE: SUMMARY: AddressSanitizer: heap-use-after-free ({{.*}}+0x{{.*}}) |
| 14 | // MISSING: ERROR: AddressSanitizer: heap-use-after-free |
| 15 | // MISSING-NOT: SUMMARY |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 16 | } |