1 // Test for ScopedDisabler. 2 // RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0" 3 // RUN: %clangxx_lsan %s -o %t 4 // RUN: LSAN_OPTIONS=$LSAN_BASE not %run %t 2>&1 | FileCheck %s 5 6 #include <stdio.h> 7 #include <stdlib.h> 8 9 #include "sanitizer/lsan_interface.h" 10 main()11int main() { 12 void **p; 13 { 14 __lsan::ScopedDisabler d; 15 p = new void *; 16 } 17 *reinterpret_cast<void **>(p) = malloc(666); 18 void *q = malloc(1337); 19 // Break optimization. 20 fprintf(stderr, "Test alloc: %p.\n", q); 21 return 0; 22 } 23 // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s) 24