1*7c3d14c8STreehugger Robot // RUN: %clangxx_asan -O %s -o %t && %run %t 2*7c3d14c8STreehugger Robot 3*7c3d14c8STreehugger Robot // FIXME: merge this with the common longjmp test when we can run common 4*7c3d14c8STreehugger Robot // tests on Windows. 5*7c3d14c8STreehugger Robot 6*7c3d14c8STreehugger Robot #include <assert.h> 7*7c3d14c8STreehugger Robot #include <setjmp.h> 8*7c3d14c8STreehugger Robot #include <stdio.h> 9*7c3d14c8STreehugger Robot #include <sanitizer/asan_interface.h> 10*7c3d14c8STreehugger Robot 11*7c3d14c8STreehugger Robot static jmp_buf buf; 12*7c3d14c8STreehugger Robot main()13*7c3d14c8STreehugger Robotint main() { 14*7c3d14c8STreehugger Robot char x[32]; 15*7c3d14c8STreehugger Robot fprintf(stderr, "\nTestLongJmp\n"); 16*7c3d14c8STreehugger Robot fprintf(stderr, "Before: %p poisoned: %d\n", &x, 17*7c3d14c8STreehugger Robot __asan_address_is_poisoned(x + 32)); 18*7c3d14c8STreehugger Robot assert(__asan_address_is_poisoned(x + 32)); 19*7c3d14c8STreehugger Robot if (0 == setjmp(buf)) 20*7c3d14c8STreehugger Robot longjmp(buf, 1); 21*7c3d14c8STreehugger Robot fprintf(stderr, "After: %p poisoned: %d\n", &x, 22*7c3d14c8STreehugger Robot __asan_address_is_poisoned(x + 32)); 23*7c3d14c8STreehugger Robot // FIXME: Invert this assertion once we fix 24*7c3d14c8STreehugger Robot // https://code.google.com/p/address-sanitizer/issues/detail?id=258 25*7c3d14c8STreehugger Robot assert(!__asan_address_is_poisoned(x + 32)); 26*7c3d14c8STreehugger Robot } 27