gcc/testsuite/c-c++-common/asan/alloca_instruments_all_paddings.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | #include "sanitizer/asan_interface.h" |
| 4 | #include <assert.h> |
| 5 | |
| 6 | __attribute__((noinline)) void foo(int index, int len) { |
| 7 | volatile char str[len] __attribute__((aligned(32))); |
| 8 | assert(!((long) str & 31L)); |
| 9 | char *q = (char *)__asan_region_is_poisoned((char *)str, 64); |
| 10 | assert(q && ((q - str) == index)); |
| 11 | } |
| 12 | |
| 13 | int main(int argc, char **argv) { |
| 14 | for (int i = 1; i < 33; ++i) |
| 15 | foo(i, i); |
| 16 | |
| 17 | for (int i = 1; i < 33; ++i) |
| 18 | foo(i, i); |
| 19 | |
| 20 | return 0; |
| 21 | } |