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